[R] sort file names in numerical order
John Kane
jrkrideau at yahoo.ca
Sat Jul 17 14:04:51 CEST 2010
library(gtools)
?mixedorder
--- On Sat, 7/17/10, Sebastian Gibb <lists at sebastiangibb.de> wrote:
> From: Sebastian Gibb <lists at sebastiangibb.de>
> Subject: [R] sort file names in numerical order
> To: r-help at r-project.org
> Received: Saturday, July 17, 2010, 4:31 AM
> Hello,
>
> I get some file names by list.files().
> These names are in alphabetical order.
> I want to change it to logical numeric order.
> Example:
> > fileNames <- c("A10", "A1", "A2", "B1", "B2",
> "B10")
> > sort(fileNames)
> [1] "A1" "A10" "A2" "B1" "B10" "B2"
> I want to have:
> "A1" "A2" "A10" "B1" "B2" "B10"
>
> Is this possible?
>
> Kind regards,
>
> Sebastian
>
> ______________________________________________
> R-help at r-project.org
> 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