Re: [R] creating and then executing command strings

2009-05-18 Thread Philipp Schmidt
help-boun...@r-project.org [mailto:r-help-boun...@r- >> project.org] On Behalf Of Philipp Schmidt >> Sent: Friday, May 15, 2009 8:35 AM >> To: Romain Francois >> Cc: r-help@r-project.org >> Subject: Re: [R] creating and then executing command strings >> &

Re: [R] creating and then executing command strings

2009-05-15 Thread Greg Snow
.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Philipp Schmidt > Sent: Friday, May 15, 2009 8:35 AM > To: Romain Francois > Cc: r-help@r-project.org > Subject: Re: [R] creating and then executing command strings > > On Fri, May 15, 2009 at 3:38 PM, Romain Francois &

Re: [R] creating and then executing command strings

2009-05-15 Thread Philipp Schmidt
On Fri, May 15, 2009 at 3:38 PM, Romain Francois wrote: > Hi, > > You can either parse and eval the string you are making, as in: > > eval( parse( text = paste("avg_",colname, " <- 0;", sep='') ) ) > > > Or you can do something like this: > > df[[ paste( "avg_", colname, sep = "" ) ]] <- 0 > Than

Re: [R] creating and then executing command strings

2009-05-15 Thread Romain Francois
Hi, You can either parse and eval the string you are making, as in: eval( parse( text = paste("avg_",colname, " <- 0;", sep='') ) ) Or you can do something like this: df[[ paste( "avg_", colname, sep = "" ) ]] <- 0 Romain Philipp Schmidt wrote: Hi: I very recently started experimenting wi

[R] creating and then executing command strings

2009-05-15 Thread Philipp Schmidt
Hi: I very recently started experimenting with R and am occasionally running into very basic problems that I can't seem to solve. If there is an R-newbies forum that is more appropriate for these kinds of questions, please direct me to it. I'd like to automatically add vectors to a dataframe. I a