Re: [R] Sort across multiple csv

2012-05-18 Thread David Winsemius
On May 18, 2012, at 12:56 PM, Matthew Ouellette wrote: Dear R help list, I am very new to R and I apologize in advance if this has been answered before. I have done my best to google/R search what I need but no luck. Here is what I am attempting: I have hundreds of .csv files that I nee

Re: [R] Sort across multiple csv

2012-05-18 Thread Rui Barradas
Hello, Try the following. # Make some data alldata <- list(matrix(rnorm(12), ncol=3), matrix(sample(100), ncol=10)) (alldata <- lapply(alldata, function(x){colnames(x) <- c("Name", LETTERS[2:ncol(x)]); x})) # This does the trick all.order <- lapply(alldata, function(x) order(x[, "Name"])) lappl

Re: [R] Sort across multiple csv

2012-05-18 Thread MacQueen, Don
You appear to have a good start. If you type alldata[[1]] do you get what you expect for the first file? This is not tested, but I would start with something like this: sorteddata <- lapply(alldata, function(df) df[order(df$Name),] ) ## then this will overwrite for (id in seq(filenames)) {

[R] Sort across multiple csv

2012-05-18 Thread Matthew Ouellette
Dear R help list, I am very new to R and I apologize in advance if this has been answered before. I have done my best to google/R search what I need but no luck. Here is what I am attempting: I have hundreds of .csv files that I need to sort based on a single column of alphanumeric data. All o