useRs, I'm using version 2.0.1 on Windows XP. I am a bit of a newbie and I am trying to learn the concept of computing on the language. I have an example that I think ought to work, but will not and I am not sure what I am doing wrong.
I would like to sort a data frame by a list of columns. Eventually I would like to wrap this in a function so that I could sort data frames by a list determined from context. Any suggestions? Thanks for your patience as I strive to learn some of the finer points. Here is a reproduction of the problem: #*************************************************************************** ************************* A <- data.frame(X = sample(c("A","B"),size=10,replace=T), Y = sample(c(T,F),size = 10, replace = T), Z = sample(1:10,size=10,replace=T)); arglist <- list(); ind <- 3:1 for(i in 1:3) { arglist[[i]] <- as.name(paste("A[,",ind[i],"]",sep="")); } do.call(what="order",args=arglist) #*************************************************************************** ************************* I get the following error message: > do.call(what="order",args=arglist) Error in order('A[,3]','A[,2]','A[,1]') : Object "A[,1]" not found > Thanks, -Tyler ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html