Skip to content
Prev 180484 / 398525 Next

creating and then executing command strings

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: