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
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
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)) {
3 matches
Mail list logo