Re: [R] eval(expr) without printing to screen?

2009-09-20 Thread hadley wickham
> Here is a simpler mockup which shows the issue: > > x = data.frame(rbind(c(1,2,3),c(1,2,3))) > xnames = c("a", "b", "c") > names(x) = xnames > > for(i in 1:length(x)) > { > # Create a varying string expression > expr = paste("y = x$", xnames[i], "[1]", sep="") > > # evaluate expression > eval(par

Re: [R] eval(expr) without printing to screen?

2009-09-20 Thread Nick Matzke
baptiste auguie wrote: Hi, What about this, eval(parse(text=expr)) (no print) HTH, baptiste Thanks. For some reason I couldn't think of that, for some reason I had a dim memory in my head that that wouldn't work, but it does. Thanks! Cheers, Nick 2009/9/19 Nick Matzke : Hi, I

Re: [R] eval(expr) without printing to screen?

2009-09-19 Thread John Sorkin
David, You can used the sink function to direct the output to a file. When you do this, nothing is printed on the screen. e.g. sink("c:\\RResu.txt") #Defines location to which output is to be written #R code goes here sink() #Turns off redirection, any code after thi

Re: [R] eval(expr) without printing to screen?

2009-09-19 Thread David Winsemius
On Sep 19, 2009, at 4:48 PM, Nick Matzke wrote: Hi, I have a script which I source, which evaluates a changing expression call hundreds of times. It works, but it prints to screen each time, which is annoying. There must be simple way to suppress this, or to use a slightly different se

Re: [R] eval(expr) without printing to screen?

2009-09-19 Thread baptiste auguie
Hi, What about this, eval(parse(text=expr)) (no print) HTH, baptiste 2009/9/19 Nick Matzke : > Hi, > > I have a script which I source, which evaluates a changing expression call > hundreds of times.  It works, but it prints to screen each time, which is > annoying.  There must be simple way

[R] eval(expr) without printing to screen?

2009-09-19 Thread Nick Matzke
Hi, I have a script which I source, which evaluates a changing expression call hundreds of times. It works, but it prints to screen each time, which is annoying. There must be simple way to suppress this, or to use a slightly different set of commands, which will be obvious to those wiser t