[R] ordering

2009-03-10 Thread aaron wells
Hello, I would like to order a matrix by a specific column. For instance: > test [,1] [,2] [,3] [1,]1 100 21 [2,]23 22 [3,]3 100 23 [4,]4 60 24 [5,]5 55 25 [6,]6 45 26 [7,]7 75 27 [8,]8 12 28 [9,]9 10 29 [10

[R] Ordering numbers

2009-12-02 Thread Lisa
Hello all, I have a set of numbers that looks like this: > id <- c(1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 1, 2, 2, 2, 3, 3, 1, 1, 1, 2, 3, 4, > 4, 4, 5, 5) > id [1] 1 1 2 2 2 3 4 4 4 4 1 2 2 2 3 3 1 1 1 2 3 4 4 4 5 5 Please ignore the bold numbers, I just want to make my problem clear. I am going to or

Re: [R] ordering

2009-03-10 Thread Peter Alspach
structure of your object. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of aaron wells > Sent: Wednesday, 11 March 2009 8:30 a.m. > To: r-help@r-project.org > Subject: [R] ordering >

Re: [R] ordering

2009-03-10 Thread David Winsemius
A) I predict that if you apply the str function to the second test that you will find that "con" is not numeric but rather of class character or factor. And the second test is probably not a matrix but rather a dataframe. Matrices in R need to have all their elements of the same class. B)

Re: [R] ordering

2009-03-10 Thread aaron wells
Thanks Peter, that did the trick. I'll modify my function so that the numeric conversion is done automatically thus saving me the extra step of converting later on. Aaron Wells > Subject: RE: [R] ordering > Date: Wed, 11 Mar 2009 08:41:50 +1300 &g

[R] ordering problem

2008-09-30 Thread Jose Luis Aznarte M.
Hi there! I need some assistance here with vector orderings. I have a set of q vectors of length p, grouped by rows in a matrix A, q·p, that I need to order lexicographically (http://en.wikipedia.org/wiki/Lexicographical_order). I also have another matrix B, p·r, and a vect

Re: [R] Ordering numbers

2009-12-02 Thread Senthil Kumar M
On Wed, Dec 2, 2009 at 3:30 PM, Lisa wrote: > > Hello all, > > I have a set of numbers that looks like this: > >> id <- c(1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 1, 2, 2, 2, 3, 3, 1, 1, 1, 2, 3, 4, >> 4, 4, 5, 5) >> id > [1] 1 1 2 2 2 3 4 4 4 4 1 2 2 2 3 3 1 1 1 2 3 4 4 4 5 5 > > Please ignore the bold num

Re: [R] Ordering numbers

2009-12-02 Thread Greg Snow
l Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Lisa > Sent: Wednesday, December 02, 2009 1:30 PM > To: r-help@r-project.org > Subject: [R] Ordering numbers > > > Hello all, > > I have a set of numbers that looks

Re: [R] Ordering numbers

2009-12-02 Thread Greg Snow
ginal Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Senthil Kumar M > Sent: Wednesday, December 02, 2009 1:36 PM > To: Lisa > Cc: r-help@r-project.org > Subject: Re: [R] Ordering numbers > > On Wed, Dec 2, 2009 at 3:

Re: [R] Ordering numbers

2009-12-02 Thread Peter Dalgaard
Greg Snow wrote: Here is one way: id <- c(1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 1, 2, 2, 2, 3, 3, 1, 1, 1, 2, 3, 4, + 4, 4, 5, 5) id [1] 1 1 2 2 2 3 4 4 4 4 1 2 2 2 3 3 1 1 1 2 3 4 4 4 5 5 tmp <- rle(id) tmp Run Length Encoding lengths: int [1:12] 2 3 1 4 1 3 2 3 1 1 ... values : num [1:12] 1

Re: [R] Ordering numbers

2009-12-02 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Lisa > Sent: Wednesday, December 02, 2009 12:30 PM > To: r-help@r-project.org > Subject: [R] Ordering numbers > > > Hello all, > > I have a se

[R] ordering data frame

2010-05-05 Thread phoebe kong
Hi all, I have problem in ordering data frame. Could anyone help me? > x [,1] [,2] [,3] [1,] "A" "1" "2" [2,] "G" "3" "2" [3,] "E" "2" "3" > y [,1] [,2] [,3] [1,] "G" "3" "3" [2,] "A" "3" "3" [3,] "E" "3" "3" I would like to order data frame x by the order of column 1 of d

[R] ordering a vector

2011-01-21 Thread Francesco Petrogalli
Hi, is there a R function that order a matrix according to some criteria based on the rows(or cols) of that matrix? For example, let's say that my matrix S is composed by n rows S_1, S_2,.., S_n and that I compute some real value g_i=g(S_i) for each row. Then I want to order this set of g_i (from

[R] Ordering box plots

2011-01-23 Thread Stuart Luppescu
Hello all, I want box plots by group to display in order of increasing mean (or median) of each group but can't seem to figure it out and couldn't find anything on R-seek, either. My data looks like this: meas unit sid gradersprti 1 2.24 1002 9902NA 0.860 2 3.04 1007 43

[R] Ordering several histograms

2011-03-03 Thread djbirdnerd
Hallo everyone, I want to evaluate the change of the distribution for several size classes. How can i order these separate histograms with the same y-axis along a common x-axis according to their size classes. It would like it to look a bit like this (http://addictedtor.free.fr/graphiques/RGraphGa

[R] ordering a boxplot

2015-03-20 Thread Antonio Silva
Hello I'm using a dataframe (mydata) where row names are sampling points and column names are species in a multivariate analysis. If I write boxplot(mydata) I'll have boxplots for each species abundance in alphabetical order. How to get the boxes orderer by the median? Usually for this I write

Re: [R] ordering problem

2008-10-07 Thread Moshe Olshansky
Try AA <- apply(A,1,function(x) paste(x,collapse="")) and work with AA. --- On Tue, 30/9/08, Jose Luis Aznarte M. <[EMAIL PROTECTED]> wrote: > From: Jose Luis Aznarte M. <[EMAIL PROTECTED]> > Subject: [R] ordering problem > To: [EMAIL PROTECTED] > Receiv

Re: [R] ordering data frame

2010-05-05 Thread Erik Iverson
phoebe kong wrote: Hi all, I have problem in ordering data frame. Could anyone help me? x [,1] [,2] [,3] [1,] "A" "1" "2" [2,] "G" "3" "2" [3,] "E" "2" "3" y [,1] [,2] [,3] [1,] "G" "3" "3" [2,] "A" "3" "3" [3,] "E" "3" "3" Are these really data.frames? They looks

[R] Ordering of facet_wrap() panels

2018-08-15 Thread Stats Student
Hi, I am generating multiple charts with facet_wrap() and what what I see, R/ggplot sorts the panels by the facet variable. So adding an index to the facet variable (1 - bucket, 2 - bucket, etc) does solve the sorting issue but it's ugly. I also read this post which, if I understand correctly,

[R] Ordering data by variable

2010-09-02 Thread Mestat
Hi listers, I could order a data that like this: x<-c(2,6,8,8,1) y<-c(1,6,3,5,4) o<-order(x) frame<-rbind(x,y)[,o] But, I would like to know if there is a way to order my data without setting up a data frame. I would like to keep independent vectors x and y. Any suggestions? Thanks in advance, Mar

[R] Ordering Duplicates for Selection

2010-10-05 Thread C C
Hi all, I've found a lot of helpful info regarding identifying and deleting duplicates but I'd like to do something a little different - I'd like to identify the duplicate values but instead of deletion, label them with a value. I am working with historical data regarding school courses:

Re: [R] ordering a vector

2011-01-21 Thread jim holtman
look at 'order' yourMatrix[order(yourMatrix[, 'yourCol']), ] On Fri, Jan 21, 2011 at 2:38 PM, Francesco Petrogalli wrote: > Hi, > is there a R function that order a matrix according to some criteria > based on the rows(or cols) of that matrix? > > For example, let's say that my matrix S is compo

Re: [R] ordering a vector

2011-01-21 Thread Peter Langfelder
I think you want the following, assuming you defined your function g(): gValues = apply(S, 1, g); Sordered = S[order(gValues), ] Peter On Fri, Jan 21, 2011 at 11:38 AM, Francesco Petrogalli wrote: > Hi, > is there a R function that order a matrix according to some criteria > based on the rows(

Re: [R] Ordering box plots

2011-01-23 Thread Ben Bolker
Stuart Luppescu ccsr.uchicago.edu> writes: > > I want box plots by group to display in order of increasing > mean (or median) of each group but can't seem to figure it out and > couldn't find anything on R-seek, either. > ?reorder ... ? __ R-help

Re: [R] Ordering box plots

2011-01-24 Thread Stuart Luppescu
On Sun, 2011-01-23 at 17:37 -0600, Stuart Luppescu wrote: [snip] Thanks to Ben and Dennis for their help, but right after I sent the original message, I figured out how to solve my problem. I noticed that boxplot() contains the at= argument. To get the box locations, I used a line like this: box.l

Re: [R] Ordering several histograms

2011-03-03 Thread Scott Chamberlain
You could get close with the ggplot2 package using the function facet_grid or facet_wrap, but each histogram would be on a separate x-axis Scott On Thursday, March 3, 2011 at 8:00 AM, djbirdnerd wrote: > Hallo everyone, > > I want to evaluate the change of the distribution for several size clas

Re: [R] Ordering several histograms

2011-03-03 Thread csrabak
Em 3/3/2011 12:00, djbirdnerd escreveu: Hallo everyone, I want to evaluate the change of the distribution for several size classes. How can i order these separate histograms with the same y-axis along a common x-axis according to their size classes. It would like it to look a bit like this (http

Re: [R] Ordering several histograms

2011-03-05 Thread djbirdnerd
not yet, but i have only just started programming in r... I don't know if i will able to... -- View this message in context: http://r.789695.n4.nabble.com/Ordering-several-histograms-tp382p3336869.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Ordering several histograms

2011-03-06 Thread Uwe Ligges
On 05.03.2011 18:40, djbirdnerd wrote: not yet, but i have only just started programming in r... I don't know if i will able to... Without quoting the former thread and without replying to a particular person (rather than the mailing list only): Do you expect anybody on the mailing list kn

Re: [R] ordering a boxplot

2015-03-21 Thread David Winsemius
On Mar 20, 2015, at 2:20 PM, Antonio Silva wrote: > Hello > > I'm using a dataframe (mydata) where row names are sampling points and > column names are species in a multivariate analysis. > > If I write boxplot(mydata) I'll have boxplots for each species abundance in > alphabetical order. > >

Re: [R] ordering a boxplot

2015-03-21 Thread William Dunlap
You can use the reorder() function to reorder the grouping vector's factor levels according to a function of the data in each group. E.g., compare the following two plots: d <- data.frame(Response=cos(1:15), Group=rep(c("A","B","C"),c(6,5,4))) par(mfrow=c(1,2)) boxplot(Response ~ Group,

Re: [R] ordering a boxplot

2015-03-21 Thread Antonio Silva
Thanks Bill and David Here goes an example SP1<-c(9,6,7,8,5,8,7,5,9,7) SP2<-c(1,3,4,2,4,2,5,3,2,1) SP3<-c(4,6,7,5,7,8,7,6,5,4) SP4<-c(5,4,3,5,2,3,4,3,4,2) mydata<-data.frame(SP1,SP2,SP3,SP4) rownames(mydata)<-c("ST1","ST2","ST3","ST4","ST5","ST6","ST7","ST8","ST9","ST10") mydata boxplot(mydata)

Re: [R] ordering a boxplot

2015-03-21 Thread Boris Steipe
There may be more concise ways to do this - but you are 99% there with your approach: try: boxplot(mydata[,names(sort(apply(mydata,2,median)))]) B. On Mar 21, 2015, at 6:49 PM, Antonio Silva wrote: > Thanks Bill and David > > Here goes an example > > SP1<-c(9,6,7,8,5,8,7,5,9,7) > SP2<-c(1,

Re: [R] ordering a boxplot

2015-03-21 Thread Boris Steipe
... just for completeness - the more concise way: (no need to go through names()). boxplot(mydata[,order(apply(mydata,2,median))]) ... or descending boxplot(mydata[,order(-apply(mydata,2,median))]) B. On Mar 21, 2015, at 7:04 PM, Boris Steipe wrote: > There may be more concise ways to d

Re: [R] ordering a boxplot

2015-03-22 Thread Antonio Silva
Dear Boris, Thanks very much, have a great week. Best regards Antônio Olinto Fisheries Institute São Paulo, Brasil 2015-03-21 21:09 GMT-03:00 Boris Steipe : > ... just for completeness - the more concise way: (no need to go through > names()). > > boxplot(mydata[,order(apply(mydata,2,median)

Re: [R] Ordering Table Columns

2013-03-02 Thread Pete Brecknock
cdouglass wrote > Hello all, > > Totally new to this and I'm just doing a frequency distribution analysis > on T-shirt sales by size. I have a .csv with 60 orders. I read in the > data using read.csv. If I look at the summary() or table() of the data it > looks fine, except that the shirt sizes

[R] Ordering List Items Chronologically

2012-11-20 Thread Simon Kiss
Dear colleagues, Is there a way to order list items by date? I have a series of surveys in a list where the name of each list item is the date the survey was taken but the list items are out of order. Each data frame has a variable in it with the survey date as well, if that helps. Yours, Simon

[R] ordering rows within CrossTable

2011-09-10 Thread Luca Meyer
Hi, I am running the following -masked- code: set.seed(23) city <- sample(c("C1","C2"),size=100,replace=T) reason <- sample(c("R1","R2","R3","R4"),size=100,replace=T) df <- data.frame(city,reason) library(gmodels) CrossTable(df$reason,df$city,prop.r=F,prop.c=F,prop.t=F,prop.chisq=F) And I get th

Re: [R] Ordering of facet_wrap() panels

2018-08-15 Thread Bert Gunter
See ?factor. You can either use ?ordered to create an ordered factor to sort the levels as you desire or sort them with factor(). e.g. > f <- factor(letters[3:1]) > f [1] c b a Levels: a b c ## default ordering > f <- factor(f, levels = letters[3:1]) > f [1] c b a Levels: c b a ## explicit or

Re: [R] Ordering of facet_wrap() panels

2018-08-15 Thread Bert Gunter
1. Unless there is good reason to keep a reply private, always cc the list. This allows more brains, possible corrections, etc. 2. Have you read ?factor and ?unique ? Always study the docs carefully. They are generally terse but complete, especially the base docs, and you can often find your answe

Re: [R] Ordering of facet_wrap() panels

2018-08-15 Thread John
On Wed, 15 Aug 2018 07:21:55 -0700 Stats Student wrote: > Hi, I am generating multiple charts with facet_wrap() and what what I > see, R/ggplot sorts the panels by the facet variable. So adding an > index to the facet variable (1 - bucket, 2 - bucket, etc) does solve > the sorting issue but it's

Re: [R] Ordering of facet_wrap() panels

2018-08-16 Thread Stats Student
Understood. Will review the docs again. My data is from an external source which, among other things, ensures that it's sorted correctly. I was asking for a way to have ggplot use the ordering in place, instead of re-ordering everything. Apologies if it wasn't clear from the original post. A

Re: [R] Ordering of facet_wrap() panels

2018-08-17 Thread Jeff Newmiller
The result does NOT depend on whether or how the data itself are sorted, but rather on how the levels of the factors in the data are sorted. Best results will be obtained if you modify the data frame factors before giving the data frame to ggplot. Doing so will allow all of the ggplot functions

Re: [R] Ordering data by variable

2010-09-02 Thread Joshua Wiley
Hi Marcio, Is this what you want? x <- c(2,6,8,8,1) y <- c(1,6,3,5,4) o <- order(x) # If you want each vector order by x x[o] y[o] You can also use sort(), but then each vector would be sorted by itself, not both by x. HTH, Josh On Thu, Sep 2, 2010 at 1:48 PM, Mestat wrote: > > Hi listers,

Re: [R] Ordering data by variable

2010-09-02 Thread Greg Snow
lp-boun...@r- > project.org] On Behalf Of Mestat > Sent: Thursday, September 02, 2010 2:49 PM > To: r-help@r-project.org > Subject: [R] Ordering data by variable > > > Hi listers, > I could order a data that like this: > x<-c(2,6,8,8,1) > y<-c(1,6,3,5,4) > o<

Re: [R] Ordering data by variable

2010-09-03 Thread Joshua Wiley
On Thu, Sep 2, 2010 at 2:33 PM, Greg Snow wrote: > Suggestion:  use the power of R. > > If x and y are independent then sorting y based on x is meaningless. > > If sorting y based on x is meaningful, then they are not independent. > > Trying to force non-independent things to pretend that they are

Re: [R] Ordering Duplicates for Selection

2010-10-05 Thread jim holtman
Here is a way of putting "Order" on your data: > x V1 V2 V3 V4 V5 1 1 12345678 Soc101 34 02-04-2003 2 2 12345678 Soc101 62 31-11-2004 3 3 12345678 Psy104 63 03-05-2003 4 4 23456789 Soc101 73 02-04-2003 5 5 23456789 Psy104 76 25-02-2004 > x$order <- ave(x$V1, x$V2, x$V3, FU

[R] Ordering data.frame based on class

2011-03-28 Thread Vincy Pyne
Dear R helpers Suppose I have a data.frame as given below - my_dat = data.frame(class = c("XYZ", "XYZ", "XYZ", "XYZ", "XYZ","ABC", "ABC", "ABC", "ABC", "ABC" ),  var1 = c(20, 14, 89, 81, 17, 44, 36, 41, 11, 36), var2 = c(1001, 250, 456, 740, 380, 641, 111, 209, 830, 920)) > my_dat    class var

Re: [R] Ordering List Items Chronologically

2012-11-20 Thread William Dunlap
ovember 20, 2012 8:41 AM > To: r-help@r-project.org > Subject: [R] Ordering List Items Chronologically > > Dear colleagues, > Is there a way to order list items by date? I have a series of surveys in a > list where the > name of each list item is the date the survey was ta

Re: [R] Ordering List Items Chronologically

2012-11-20 Thread Sarah Goslee
As long as all your names of list elements are in the same format, this should do it: mylist[order(names(mylist))] Thanks for the reproducible example, Sarah On Tue, Nov 20, 2012 at 11:40 AM, Simon Kiss wrote: > Dear colleagues, > Is there a way to order list items by date? I have a series of

Re: [R] ordering rows within CrossTable

2011-09-10 Thread Marc Schwartz
On Sep 10, 2011, at 4:03 PM, Luca Meyer wrote: > Hi, > > I am running the following -masked- code: > > set.seed(23) > city <- sample(c("C1","C2"),size=100,replace=T) > reason <- sample(c("R1","R2","R3","R4"),size=100,replace=T) > df <- data.frame(city,reason) > library(gmodels) > CrossTable(df$r

[R] Ordering zoo-object by its index

2009-07-09 Thread Sergey Goriatchev
Hello everyone, Say I have zoo object x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 x <- zoo(rnorm(5), x.Date) y <- zoo(rt(5, df=2), x.Date) z <- zoo(rt(5, df=5), x.Date) Data <- merge(x,y,z) What should I do to make the latest values appear at the top? Thank you for your help! Rega

[R] ordering and factors into column headings

2009-09-01 Thread Krista Chin
Hi, The lab in which I send my samples return the results in a format that is difficult for me to run my analysis. The lab outputs the results where each parameter is its own row and it’s not consistently in the same order (and not each sample is tested for the same suite of variables). e.g. >d

[R] ordering columns in a data frame

2010-03-10 Thread Newbie19_02
Dear R users, I have the following data frame: PROCHIdate_admission 2 CAO713 1999-12-11 4 CAO713 1999-10-25 21 CAO0001743 1989-05-04 25 CAO0001743 1996-09-12 26 CAO0001743 1989-05-17 27 CAO0001743 1987-09-17 28 CAO0001743 1987-09-19 2

Re: [R] Ordering data.frame based on class

2011-03-28 Thread Henrique Dallazuanna
Try this: my_dat[order(my_dat$class, -my_dat$var1, decreasing = TRUE),] On Mon, Mar 28, 2011 at 5:55 PM, Vincy Pyne wrote: > Dear R helpers > > Suppose I have a data.frame as given below - > > my_dat = data.frame(class = c("XYZ", "XYZ", "XYZ", "XYZ", "XYZ","ABC", "ABC", > "ABC", "ABC", "ABC" ),

Re: [R] Ordering data.frame based on class

2011-03-28 Thread Vincy Pyne
Dear sir, Thanks for the great solution. Regards Vincy --- On Mon, 3/28/11, Henrique Dallazuanna wrote: From: Henrique Dallazuanna Subject: Re: [R] Ordering data.frame based on class To: "Vincy Pyne" Cc: r-help@r-project.org Received: Monday, March 28, 2011, 9:02 PM Try thi

[R] Ordering the levels of a vector

2007-12-03 Thread Judith Flores
Hi, I have a vector in a data frame that looks something like this: day<-c('Day -1','Day 6','Day 10') This vector specifies the order in which several panel will appear in a lattice plots. But the order in which such plots will appear will be the following: Day -1, Day 10, Day 6. Which ma

[R] ordering a factor in boxplot output

2008-04-30 Thread Tubin
I'm sure I'm missing something obvious in the documentation... I'm generating a boxplot boxplot(CleanValue~ApptCategory*ReportingCode,data=newfile) where ApptCategory is a factor with possible values ("New","Established") Problem is, the output orders those factors alphabetically, and I'd reall

Re: [R] Ordering zoo-object by its index

2009-07-09 Thread Gabor Grothendieck
To display that object in reverse time order try this: as.data.frame(Data)[nrow(Data):1, ] On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goriatchev wrote: > Hello everyone, > > Say I have zoo object > > x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 > x <- zoo(rnorm(5), x.Date) > y <- zoo(rt(5

Re: [R] Ordering zoo-object by its index

2009-07-09 Thread Sergey Goriatchev
Hi, Gabor Thank you! That is exactly what I did, even before your email. :-) Regards, Sergey On Thu, Jul 9, 2009 at 12:52, Gabor Grothendieck wrote: > To display that object in reverse time order try this: > > as.data.frame(Data)[nrow(Data):1, ] > > > On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goria

Re: [R] Ordering zoo-object by its index

2009-07-09 Thread Gabor Grothendieck
One additional thought. If the reason you want to do that is just so that you can see the last few rows more easily then tail(Data) will display the last few rows or tail(Data, 10) will display the last 10 rows. On Thu, Jul 9, 2009 at 7:36 AM, Sergey Goriatchev wrote: > Hi, Gabor > > Thank you!

Re: [R] Ordering zoo-object by its index

2009-07-09 Thread Sergey Goriatchev
Hi, Gabor Yes, I am familiar with tail() function. I use it extensively on a day to day basis. In this particular case I needed to order a zoo object by date, after I have created it with RBloomberg. Thank you for your time! Regards, Sergey On Thu, Jul 9, 2009 at 14:36, Gabor Grothendieck wrote

Re: [R] ordering and factors into column headings

2009-09-02 Thread Henrique Dallazuanna
Try this also: xtabs(value ~ site + parameter, data = DF) On Tue, Sep 1, 2009 at 8:59 PM, Krista Chin <0574...@acadiau.ca> wrote: > Hi, > > The lab in which I send my samples return the results in a format that > is difficult for me to run my analysis. The lab outputs the results > where each p

Re: [R] ordering and factors into column headings

2009-09-01 Thread Gabor Grothendieck
Try the reshape package: > library(reshape) > cast(DF, site ~ parameter) site e1 e2 e3 e4 e5 1a 1 3 5 NA NA 2b 2 NA 1 NA NA 3c NA 2 NA 5 4 4d NA 4 NA 3 NA 5e 2 NA NA NA NA (or the reshape command in R). On Tue, Sep 1, 2009 at 7:59 PM, Krista Chin<0574...@acadiau.

Re: [R] ordering columns in a data frame

2010-03-10 Thread David Freedman
I'm not sure what's incorrect about your result, but the following works: d=data.frame(a=sample(letters[1:5],10,rep=T),b=rnorm(10),c=sample(1:10,10)); d d[order(d$a,d$c),] or, you can use orderBy: lib(doBy) orderBy(~a+b,data=d) #use a - sign to sort in descending sequence Did you leave off the

Re: [R] ordering columns in a data frame

2010-03-10 Thread Newbie19_02
Thanks David. Leaving off the tilde was the problem. -- View this message in context: http://n4.nabble.com/ordering-columns-in-a-data-frame-tp1587294p1587491.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org maili

[R] Ordering variables in a parallel coordinates plot

2010-01-02 Thread Tal Galili
Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in general, here is such example: http://tiny

[R] Ordering Filenames stored in list or vector

2015-12-04 Thread BARLAS Marios 247554
Hello everyone, I am an R rookie and I'm learning as I program. I am working on a script to process a large amount of data: I read a pattern of filenames in the folder I want and import their data filenames = list.files(path, pattern="*Q_Read_prist*") myfiles = lapply(filenames, function(x) re

[R] Ordering a matrix based on cluster no

2011-06-26 Thread Aparna Sampath
Hi All I have a symmetric matrix of genes ( 100x100 matrix). I also have a matrix (100x2) of two columns where column 1 has the gene names and column 2 has the cluster it belongs to (they are sorted and grouped based on the cluster no). I would like to order the rows and columns of the 100x 100 m

[R] Ordering the rows of a data frame

2014-01-03 Thread Stefano Sofia
Dear R users, I have two files of seasonal rainfall data (more than 10,000 rows each); here the first 8 rows of each file are reported. Code_Raingouge,Y_init,M_init,D_init,h_init,m_init,Y_fin,M_fin,D_fin,h_fin,m_fin,Rainfall,N_Values,Quality_Level,Code_Station 2000,1952,12,1,0,0,1953,3,1,0,0,307

[R] Ordering of stack in ggplot (package ggplot2)

2011-10-18 Thread swonder03
I'm trying to reproduce the 3rd graph on the page of this site: http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ . However, the data below produces a ggplot with the stacks sorted in alphabetical order from the bottom up. I'd like the stacks to be in the order "Europe", "Asia", "Americas, "

Re: [R] Ordering the levels of a vector

2007-12-03 Thread Deepayan Sarkar
On 12/3/07, Judith Flores <[EMAIL PROTECTED]> wrote: > Hi, > >I have a vector in a data frame that looks > something like this: > > day<-c('Day -1','Day 6','Day 10') > > >This vector specifies the order in which several > panel will appear in a lattice plots. But the order in > which such p

Re: [R] Ordering the levels of a vector

2007-12-03 Thread Marc Schwartz
On Mon, 2007-12-03 at 13:21 -0800, Judith Flores wrote: > Hi, > >I have a vector in a data frame that looks > something like this: > > day<-c('Day -1','Day 6','Day 10') > > >This vector specifies the order in which several > panel will appear in a lattice plots. But the order in > whic

Re: [R] Ordering the levels of a vector

2007-12-03 Thread Gabor Grothendieck
Try mixedsort in the gtools package. On Dec 3, 2007 4:21 PM, Judith Flores <[EMAIL PROTECTED]> wrote: > Hi, > > I have a vector in a data frame that looks > something like this: > > day<-c('Day -1','Day 6','Day 10') > > > This vector specifies the order in which several > panel will appear in

Re: [R] ordering a factor in boxplot output

2008-04-30 Thread Peter Alspach
... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tubin > Sent: Thursday, 1 May 2008 6:40 a.m. > To: r-help@r-project.org > Subject: [R] ordering a factor in boxplot output > > > I'm sure I'm missing som

Re: [R] ordering a factor in boxplot output

2008-05-01 Thread S Ellison
The factor order defaults to alphabetical, and boxplot follows that. Re-ordering the factor to the order of interest is probably the best way of handling it. However, if you don;t want to do that, you could perhaps also use the at= parameter in boxplot. For example x<-rnorm(50) g<-factor(rep(c("

Re: [R] ordering a factor in boxplot output

2008-05-01 Thread Tubin
at is probably what you want. HTH ... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tubin > Sent: Thursday, 1 May 2008 6:40 a.m. > To: r-help@r-project.org > Subject: [R] ordering a factor in boxplot outp

[R] Ordering categories on a boxplot - a serious trap??

2010-02-25 Thread Schwab,Wilhelm K
Hello all, I think I probably did something stupid, and R's part was to allow me to do it. My goal was to control the order of factor levels appearing horizontally on a boxplot. Enter search engines and perhaps some creative stupidity on my part, and I came up with the following: v=r

Re: [R] Ordering variables in a parallel coordinates plot

2010-01-03 Thread Charles C. Berry
On Sat, 2 Jan 2010, Tal Galili wrote: Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in g

Re: [R] Ordering variables in a parallel coordinates plot

2010-01-03 Thread Tal Galili
Hi Charles, Thanks for answering - you are right about the posting guide (sorry). In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. Thanks, Tal Contact Details:---

Re: [R] Ordering variables in a parallel coordinates plot

2010-01-03 Thread Tal Galili
Hi Charles, You're solution is great (and is actually what my professor suggested me to do today). In the meantime I searched even more and found this article: http://davis.wpi.edu/~xmdv/docs/tr0313_osf.pdf That gives a good description of the problem and of his attempts at solving it. I started

Re: [R] Ordering variables in a parallel coordinates plot

2010-01-03 Thread Charles C. Berry
On Sun, 3 Jan 2010, Tal Galili wrote: Hi Charles, Thanks for answering - you are right about the posting guide (sorry). In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. OK, and I see you included a reference, so t

Re: [R] Ordering variables in a parallel coordinates plot

2010-01-03 Thread Dieter Menne
Hi, Tal, Tal Galili wrote: > > In any case, my question wasn't on how to reorder the columns (that is > simple), but on how to choose what order to put them in. > So is your question answered? Or what exactly is the problem using the example below? library(lattice) parallel(~iris[1:4] | Spec

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Boris Steipe
The thread below has a number of solutions. I personally like the one with sprintf(). https://stat.ethz.ch/pipermail/r-help/2010-July/246059.html B. On Dec 4, 2015, at 5:51 AM, BARLAS Marios 247554 wrote: > Hello everyone, > > I am an R rookie and I'm learning as I program. > > I am work

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Henrik Bengtsson
> filenames <- c("Q_Read_prist#1...@1.xls", "Q_Read_prist#1...@10.xls", > "Q_Read_prist#1...@2.xls") > filenames <- gtools::mixedsort(filenames, numeric.type="decimal") > filenames [1] "Q_Read_prist#1...@1.xls" "Q_Read_prist#1...@2.xls" "Q_Read_prist#1...@10.xls" /Henrik On Fri, Dec 4, 2015 a

Re: [R] Ordering Filenames stored in list or vector

2015-12-04 Thread Mark Sharp
Mario, I am certain there are more elegant solutions. This is an effort to make the process clear by dividing out each transformation used into separate lines. ## Start of code library(stringi) # This is written in C and C++ (ICU library), is fast, and is well documented. filenames <- c("Q_Read

Re: [R] Ordering Filenames stored in list or vector

2015-12-07 Thread BARLAS Marios 247554
tarting my PhD I feel like I want something more "integrated" Thanks, Mario From: Mark Sharp [msh...@txbiomed.org] Sent: Friday, December 04, 2015 5:25 PM To: BARLAS Marios 247554 Cc: r-help@r-project.org Subject: Re: [R] Ordering Filenames stor

Re: [R] Ordering a matrix based on cluster no

2011-06-26 Thread John Kane
ot;,"c", "d", "e"),5)) df1 <- data.frame(smat, bmat) orddata <- df1[order(df1[,2],decreasing=TRUE),] I hope this helps. --- On Sun, 6/26/11, Aparna Sampath wrote: > From: Aparna Sampath > Subject: [R] Ordering a matrix based on cluster no > To: r

Re: [R] Ordering a matrix based on cluster no

2011-06-26 Thread Aparna Sampath
Thanks for the help! But when I tried it, it does not work the same way I want. :( after combining the two matrices, they look like this: V1V2 X TEL.AML1.C41 Hyperdip.50.C23 1 TEL.AML1.C41 1TEL.AML1.C41 1.000 0.

Re: [R] Ordering a matrix based on cluster no

2011-06-27 Thread John Kane
r the gene name. merge (smat, bmat, by= “gene”) # untested Then apply the order command. I hope I understood the problem this time --- On Mon, 6/27/11, Aparna Sampath wrote: > From: Aparna Sampath > Subject: Re: [R] Ordering a matrix based on cluster no > To: r-help@r-project.

[R] Ordering in Sankey diagram using R and googleVis

2015-07-22 Thread Angela via R-help
Hello, I am trying to figure out if there is a way to order the left side of a Sankey diagram from most frequent to least frequent. I am using R version 3.2.1 and using googleVis version 0.5.9 for the Sankey. I've tried sorting, but that does not work. Is there anyway to force it to arrange the

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Ista Zahn
On Fri, Jan 3, 2014 at 9:41 AM, Stefano Sofia wrote: > > Dear R users, > I have two files of seasonal rainfall data (more than 10,000 rows each); here > the first 8 rows of each file are reported. > > Code_Raingouge,Y_init,M_init,D_init,h_init,m_init,Y_fin,M_fin,D_fin,h_fin,m_fin,Rainfall,N_Value

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Dmitry Pavlyuk
Hi Sofia! You need to attach the data file before sorting: attach(df_final) or just use full qualified names (like df_final$Y_init) Dmitry On 03/01/2014 16:41, Stefano Sofia wrote: > Dear R users, > I have two files of seasonal rainfall data (more than 10,000 rows each); here > the first 8 ro

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Bert Gunter
Inline Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Fri, Jan 3, 2014 at 7:08 AM, Dmitry Pavlyuk wrote: > Hi Sofia! > > You need to attach the data file before

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Dmitry Pavlyuk
Bert, why do you think that "attach" is not working in this case? Did you check it before your advice? :) I agree about "generally bad approach", but it is quite convenient for work with one data set. Dmitry On 03/01/2014 18:28, Bert Gunter wrote: Inline Bert Gunter Genentech Nonclinical Bio

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Bert Gunter
You misunderstand = I was not sufficiently clear. What is false is your statement that "you **need** to attach the data file before sorting." You do not. with()/within() can be used to avoid using the fully qualified names without attaching. I did not claim that attaching first would not work, onl

Re: [R] Ordering the rows of a data frame

2014-01-03 Thread Dmitry Pavlyuk
Ah, ok, thank you for explanations! Dmitry On 03/01/2014 20:00, Bert Gunter wrote: You misunderstand = I was not sufficiently clear. What is false is your statement that "you **need** to attach the data file before sorting." You do not. with()/within() can be used to avoid using the fully qual

Re: [R] Ordering of stack in ggplot (package ggplot2)

2011-10-18 Thread Dennis Murphy
Hi: levels(df.m2$Region) [1] "Africa" "Americas" "Asia" "Europe" "Oceania" Reorder your Region factor to the following: df.m2$Region <- factor(df.m2$Region, levels = c('Europe', 'Asia', 'Americas', 'Africa', 'Oceania')) Then recopy the code from the definitio

Re: [R] Ordering of stack in ggplot (package ggplot2)

2011-10-18 Thread David Winsemius
On Oct 18, 2011, at 7:59 PM, swonder03 wrote: I'm trying to reproduce the 3rd graph on the page of this site: http://learnr.wordpress.com/2009/03/17/ggplot2-barplots/ . However, the data below produces a ggplot with the stacks sorted in alphabetical order from the bottom up. I'd like the st

Re: [R] Ordering of stack in ggplot (package ggplot2)

2011-10-18 Thread swonder03
That worked great thank you. -- View this message in context: http://r.789695.n4.nabble.com/Ordering-of-stack-in-ggplot-package-ggplot2-tp3917159p3917520.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing lis

  1   2   >