Hello, I'm having trouble in using "assign(paste ..." command . I could create several dataframes following trinomial distribution using it but it could not be used to check their row means of the created dataframe.
For example, the following works: probTrt=matrix(0,4,3); probTrt; #malf, death, normal probTrt[1,]=c(0.064,0.119,0.817);#for Trt 1 probTrt[2,]=c(0.053,0.125,0.823);#for Trt 2 probTrt[3,]=c(0.111,0.139,0.750);#for Trt 3 probTrt[4,]=c(0.351,0.364,0.285);#for Trt 4 for (t in 4){ assign(paste("Trt",t,sep=""),rmultinom(10, size = 5, prob=probTrt[t,])); } But the following does not work. for (t in 4){ assign(paste("Trt",t,sep=""),rmultinom(10, size = 5, prob=probTrt[t,])); rowMeans(paste("Trt",t,sep="")); } How can I use it in functions like rowMeans so that I don't have to type all the object names? Thank you. Kyeongmi [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.