How "eval" results returned by "paste0" ?
1
0
Entering edit mode
my1stbox ▴ 40
@my1stbox-6702
Last seen 10.2 years ago
Hi All, It seem that I can never get the returned values of 'paste0' been evaluated , as well as any characters that have been quoted. Do I have to use 'substr' or 'gsub' to remove these quotation marks ? Bests, Allen Chiu > eval(paste0('1','+','1')) [1] "1+1" > eval(expression(paste0('1','+','1'))) [1] "1+1" > eval(expression("1+1")) [1] "1+1" > eval("1+1") [1] "1+1" > eval(expression(1+1)) [1] 2 > eval(1+1) [1] 2 2014-08-20 [[alternative HTML version deleted]]
• 1.7k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.0 years ago
United States
The result of paste0 is a character vector, so it's already evaluated and eval() will act like identity(). If you want to convert your character vector to a language object, use parse(text=v), so: > eval(parse(text=paste0('1','+','1'))) [1] 2 On Wed, Aug 20, 2014 at 5:40 AM, my1stbox <my1stbox at="" 163.com=""> wrote: > Hi All, > It seem that I can never get the returned values of 'paste0' been > evaluated , as well as any characters that have been quoted. Do I have to > use 'substr' or 'gsub' to remove these quotation marks ? > Bests, > Allen Chiu > > > eval(paste0('1','+','1')) > [1] "1+1" > > eval(expression(paste0('1','+','1'))) > [1] "1+1" > > eval(expression("1+1")) > [1] "1+1" > > eval("1+1") > [1] "1+1" > > eval(expression(1+1)) > [1] 2 > > eval(1+1) > [1] 2 > > > > > > > 2014-08-20 > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 833 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6