[R] ordering in list.files

Gabor Grothendieck ggrothendieck at gmail.com
Fri May 18 17:40:57 CEST 2007


Try this:

library(gtools)
mixedsort(x)


On 5/18/07, Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:
> Hi R,
>
>
>
> My csv files are stored in the order, '1abc.csv', '2def.csv',
> '3ghi.csv', '10files.csv' in a folder. When I read this into R from
> list.files (R command: x=list.files("Z:/CSV/fold",full.names=F), I don't
> get the same order, instead I get the order as "10files.csv" "1abc.csv"
> "2def.csv"    "3ghi.csv". But I don't want this ordering. So, how do I
> maintain the oder which I have in my physical folder?
>
>
>
> Thanks in advance
>
> Shubha
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list