[R] Sorting alphanumerically

2006-02-24 Thread mtb954 mtb954
I'm trying to sort a DATAFRAME by a column "ID" that contains alphanumeric data. Specifically,"ID" contains integers all preceeded by the character "g" as in: g1, g6, g3, g19, g100, g2, g39 I am using the following code: DATAFRAME=DATAFRAME[order(DATAFRAME1$ID),] and was hoping it would sort th

Re: [R] Sorting alphanumerically

2006-02-24 Thread Gabor Grothendieck
This was just discussed recently. Try: library(gtools) ?mixedorder On 2/24/06, mtb954 mtb954 <[EMAIL PROTECTED]> wrote: > I'm trying to sort a DATAFRAME by a column "ID" that contains > alphanumeric data. Specifically,"ID" contains integers all preceeded > by the character "g" as in: > > g1, g6,

Re: [R] Sorting alphanumerically

2006-02-24 Thread Marc Schwartz (via MN)
On Fri, 2006-02-24 at 12:54 -0600, mtb954 mtb954 wrote: > I'm trying to sort a DATAFRAME by a column "ID" that contains > alphanumeric data. Specifically,"ID" contains integers all preceeded > by the character "g" as in: > > g1, g6, g3, g19, g100, g2, g39 > > I am using the following code: > > D

Re: [R] Sorting alphanumerically

2006-02-24 Thread Chuck Cleland
Does this help? ID <- paste("g", sample(1:100, 100, replace=FALSE), sep="") ID [1] "g88" "g5" "g79" "g67" "g43" "g21" "g66" [8] "g9" "g38" "g86" "g12" "g85" "g74" "g34" [15] "g52" "g95" "g6" "g22" "g70" "g87" "g7" [22] "g83" "g63" "g42" "g26" "g65" "g16" "g97"

Re: [R] Sorting alphanumerically

2006-02-24 Thread Mark
Thank you all, for your help. Mark On 2/24/06, Chuck Cleland <[EMAIL PROTECTED]> wrote: > Does this help? > > ID <- paste("g", sample(1:100, 100, replace=FALSE), sep="") > > ID >[1] "g88" "g5" "g79" "g67" "g43" "g21" "g66" >[8] "g9" "g38" "g86" "g12" "g85" "g74" "g34" > [15