R programming logic

0 votes

Below is a character vector in R.

longString <- "ggstyle<-function(inputFile {tableMedian=inputFile#plotstyleroutine#thislinesolvestheproblemifthemedianofevennumberofdaysistakenbytakingthevectornumberdayMedVec=round(length(unique(tableMedian$day))/2,0)dayMed=as.numeric(unique(tableMedian$day)[dayMedVec])x=tableMedian[tableMedian$day==dayMed,]p=ggplot(x,aes(x=AGE,y=SCORES))+geom_bar(stat=\"identity\",alpha=1)print(p)}"

Need a logic to get the following:

ggstyle(inputFile)

Nov 16, 2018 in Data Analytics by Ali
• 11,360 points
767 views

1 answer to this question.

0 votes

Use gsub to match the substring that we want to delete and replace it with ''

gsub("[[:punct:]]+function|\\{.*", "", longString)
#[1] "ggstyle(inputFile)"


Hope this helps!

To learn more, enroll with R programming for data science online.

Thanks.

answered Nov 16, 2018 by Maverick
• 10,840 points

Related Questions In Data Analytics

0 votes
2 answers

What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 33,030 points
15,182 views
+1 vote
1 answer

R programming Web Scraping

Try something like this: library(rvest) library(rvest) library(tidyverse) urls <- read_html("https://www.edureka.co/aws-certification-training") pag <- ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,840 points
1,006 views
0 votes
1 answer

Expression Computation - R programming

The sequence of ones: cumsum(10^(0:4)) ## [1] ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,840 points
523 views
+1 vote
1 answer

Difference between factor and as.factor in R programming

Hey @Ali, as.factor is a wrapper for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,840 points
4,899 views
+10 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 9, 2018 in Data Analytics by Abhi
• 3,720 points
1,670 views
+1 vote
2 answers
0 votes
1 answer
+5 votes
2 answers
0 votes
1 answer

Why should I adopt R programming

R Programming is the best mechanism for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,840 points
849 views
+3 votes
2 answers

Error: could not find function - R Programming

Yes, Just like @Maverik said, It happens ...READ MORE

answered Aug 23, 2019 in Data Analytics by anonymous
• 33,030 points
33,774 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP