My files (>100) are:
AT.BP.50.txt
AT.BP.200.txt
AT.BP.500.txt
SP.BP.50.txt
SP.BP.200.txt
SP.BP.500.txt
....
I want to plot them with R.
Usually I do it by this:
files <- list.files()
par(mfrow=c(3,3))
for (i in 1:length(files)) {
b <- read.table(files[i])
barplot(table(b), main=files[i])
....
But R plots them in such order:
"AT.BP.200.txt" "AT.BP.500.txt" "AT.BP.50.txt"
"SP.BP.200.txt" "SP.BP.500.txt" "SP.BP.50.txt"
........
And I want them to be plotted in sorted order:
"AT.BP.50.txt" "AT.BP.200.txt" "AT.BP.500.txt"
"SP.BP.50.txt" "SP.BP.200.txt" "SP.BP.500.txt"
........
How can I do that?
What is the point of closing a question if it already has an answer? I sort files and stuff all the time when I'm doing bioinformatics, and I'm rarely confident I'm doing it the best way. I depend on serendipitous information like this to stumble on better methods. Given that there's already an answer, closing the question simply precludes the possibility of a better answer. How does that make life better?
I think the original poster would actually get the best answer on stack overflow, there's a lot of R gurus over there. I recommend any people here interested in R questions like this follow the rss feed for the R tag from stack overflow. Biostars is supposed to be limited to bioinformatics specific questions. Just trying to keep the internet organized.
"Biostars is supposed to be limited to bioinformatics specific questions." I guess that explains why a question about decreasing sequencing costs remains open and gets 29 votes. :) I agree that this question could have been geared more explicitly towards bioinformatics with perhaps two words "My sequence score files..." But consider that a programmer doing bioinformatics might see this as simply a sorting question to be asked in another expert forum, whereas a biologist trying to do bioinformatics thinks that engaging in programming in a biological context is doing bioinformatics and would ask it where they see people doing bioinformatics, and people like me find it related, and useful, and welcome, even thought the word "bioinformatics" was not used in the question. Just trying to keep the internet open and collegial.
Okay, go for it.
I would post this on stackoverflow.com, it's not exactly bioinformatics-centric.