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
• 10,670 points
58 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)"
answered Nov 16, 2018 by Maverick
• 10,820 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
• 32,460 points
721 views
0 votes
1 answer

R programming Web Scraping

Try something like this: library(rvest) library(rvest) library(tidyverse) urls <- read_html("http://dk.farnell.com/c/office-computer-networking-products/prl/results/") pag <- ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,820 points
234 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,820 points
39 views
0 votes
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,820 points
1,922 views
+9 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 8, 2018 in Data Analytics by Abhi
• 3,680 points
163 views
+1 vote
2 answers
0 votes
1 answer
+4 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,820 points
68 views
0 votes
2 answers

Error: could not find function - R Programming

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

answered Aug 22, 2019 in Data Analytics by anonymous
• 32,460 points
15,278 views