Re: [R] sorting dataframe

2012-10-03 Thread killerkarthick
Please show the data set... -- View this message in context: http://r.789695.n4.nabble.com/sorting-dataframe-tp840507p4644857.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list h

Re: [R] sorting dataframe by arbitrary order

2011-10-14 Thread Trevor Davies
00 >d10001000 >b00100010 > > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@

Re: [R] sorting dataframe by arbitrary order

2011-10-14 Thread William Dunlap
b00100010 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Trevor Davies > Sent: Friday, October 14, 2011 12:05 PM > To

[R] sorting dataframe by arbitrary order

2011-10-14 Thread Trevor Davies
This has been dogging me for a while. I've started making a lot of tables via xtable so the way I want to sort things is not always in alphabetical or numerical order. As an example, consider I have a dataframe as follows set.seed(100) a <- data.frame(V1=sample(letters[1:4],100, replace=T),V2=1:1

Re: [R] Sorting dataframe by number of occurrences of factor

2011-05-01 Thread adigs
That's great - thanks all for your help.-- View this message in context: http://r.789695.n4.nabble.com/Sorting-dataframe-by-number-of-occurrences-of-factor-tp3485443p3488978.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proj

Re: [R] Sorting dataframe by number of occurrences of factor

2011-04-30 Thread Oliver
to the first two lines of your solutions df<-data.frame(id=c(1:20),name=c('a','b','b','c','a','d','b','e', 'd','d','c','a','b','a','a','b','f','b','c','g')) freq <- ave(rep(1, times=nrow(df)), df$name, FUN=sum) I would add: df[ sort.list(freq), ] __

Re: [R] Sorting dataframe by number of occurrences of factor

2011-04-30 Thread Sharma D
df<-data.frame(id=c(1:20),name=c('a','b','b','c','a','d','b','e','d','d','c','a','b','a','a','b','f','b','c','g')) freq <- ave(rep(1, times=nrow(df)), df$name, FUN=sum) rowSums(table(df$name,freq)) -- View this message in context: http://r.789695.n4.nabble.com/Sorting-dataframe-by-number-of-occ

Re: [R] Sorting dataframe by number of occurrences of factor

2011-04-30 Thread Petr Savicky
On Fri, Apr 29, 2011 at 11:17:58PM -0700, adigs wrote: > Apologies for what's probably quite simple, but I'm having some problems with > sorting a data frame by the number of occurences of each level of a factor. > > df<-data.frame(id=c(1:20),name=c('a','b','b','c','a','d','b','e','d','d','c','a',

[R] Sorting dataframe by number of occurrences of factor

2011-04-30 Thread adigs
Apologies for what's probably quite simple, but I'm having some problems with sorting a data frame by the number of occurences of each level of a factor. df<-data.frame(id=c(1:20),name=c('a','b','b','c','a','d','b','e','d','d','c','a','b','a','a','b','f','b','c','g')) I want to sort the dataframe

Re: [R] sorting dataframe

2007-11-21 Thread Søren Højsgaard
- or the orderBy function in the doBy package. Soren From: [EMAIL PROTECTED] on behalf of Henrik Bengtsson Sent: Wed 21-11-2007 11:14 To: Rina Oldager Miehs Cc: r-help@r-project.org Subject: Re: [R] sorting dataframe See order(). -Henrik On 21/11/2007, Rina

Re: [R] sorting dataframe

2007-11-21 Thread Henrik Bengtsson
See order(). -Henrik On 21/11/2007, Rina Oldager Miehs <[EMAIL PROTECTED]> wrote: > Hello > > We have a problem with sorting our dataframe... > i have tried to write > > x <- males[sort(males$index, decreasing=T),] > > But that just gives me > > > x > id sex BVgain BVmeat phenogain phenomeat

[R] sorting dataframe

2007-11-21 Thread Rina Oldager Miehs
Hello We have a problem with sorting our dataframe... i have tried to write x <- males[sort(males$index, decreasing=T),] But that just gives me > x id sex BVgain BVmeat phenogain phenomeat index NANA NA NA NANANANA NA.1 NA NA NA NANA