Displaying 1 result from an estimated 1 matches for "mean_dog".
2011 Mar 31
3
Create Variable names dynamically
...xample, please excuse any shortcuts...
data <- read.table("file", ....)
animals <- (data[,animal])
animals
> "cat", "dog", "horse" # Not known what these are before I read the data file
# do a bunch of stuff
mean_cat <- abc
var_cat <- dfd
mean_dog <- 123
var_dog <- 453
etc..
##############
I thought of trying to use the paste() function to create the variable name, but that doesn't work:
for( animal in animals){
paste("mean", animal "_") <- 123
}
Any ideas???
Thanks
--
Noah Silverman