Displaying 1 result from an estimated 1 matches for "avg_col1".
Did you mean:
avg_col2
2009 May 15
1
creating and then executing command strings
...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 am able to
build command strings that would do what I want, but R is not
executing them.
A simplified example:
# Add three vectors called avg_col1, avg_col2, avg_col3 to dataframe df
for(colname in c("col1", "col2", "col3")){
print(paste("df$avg_",colname, " <- 0;", sep='')) # Just using this
to make sure the command is correct
paste("avg_",colname, " <- 0;"...