Hi
Yes it is possible- one way is:
fileNames[order(sprintf(%02s, sub([[:upper:]],, fileNames)))]
[1] A1 B1 A2 B2 A10 B10
Regards
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email home: mac...@northnet.com.au
At 06:47
Another option:
require(gtools)
?mixedsort
mixedsort(fileNames)
[1] A1 A2 A10 B1 B2 B10
--
David
On Jul 18, 2010, at 5:16 AM, Duncan Mackay wrote:
Hi
Yes it is possible- one way is:
fileNames[order(sprintf(%02s, sub([[:upper:]],, fileNames)))]
[1] A1 B1 A2 B2 A10 B10
Regards
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,
library(gtools)
?mixedorder
--- On Sat, 7/17/10, Sebastian Gibb li...@sebastiangibb.de wrote:
From: Sebastian Gibb li...@sebastiangibb.de
Subject: [R] sort file names in numerical order
To: r-help@r-project.org
Received: Saturday, July 17, 2010, 4:31 AM
Hello,
I get some file names
On Sat, Jul 17, 2010 at 4:31 AM, Sebastian Gibb li...@sebastiangibb.de wrote:
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
thanks a lot, it works.
you wrote:
library(gtools)
?mixedorder
--- On Sat, 7/17/10, Sebastian Gibb li...@sebastiangibb.de wrote:
From: Sebastian Gibb li...@sebastiangibb.de
Subject: [R] sort file names in numerical order
To: r-help@r-project.org
Received: Saturday, July 17, 2010, 4
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?
7 matches
Mail list logo