Re: [R] Help using order with data.frame

2014-03-16 Thread arun
Hi, Try:  data_test<-data.frame(id, dates, info, sqfootage, lotsize,stringsAsFactors=FALSE)  data_test[order(with(data_test,as.Date(dates,"%m/%d/%Y"))),]    id dates   info sqfootage lotsize 3 ID3 2/03/2013 siding  3000    0.75 2 ID2 1/16/2014   wood  2000    0.50 1 ID1 2/16/2014  br

Re: [R] Help using order with data.frame

2014-03-16 Thread Jason Rupert
Thank you very much for your posts.  I updated the example, which was taken from the following: http://cran.r-project.org/doc/contrib/Torfs+Brauer-Short-R-Intro.pdf Hopefully the below is a bit more representative question, but unfortunately, it looks like I'm not inputting the dates informati

Re: [R] Help using order with data.frame

2014-03-16 Thread arun
Try:  t[order(t$z),] #or t[with(t,order(z)),] A.K. On Sunday, March 16, 2014 12:27 AM, Jason Rupert wrote: Evidently, I'm overlooking something simple.  I'm trying to used order with data.frame.   For example: t = data.frame(x = c(11,12,14), y = c(19,20,21), z = c(10,9,7)) t[order(z), ]

Re: [R] Help using order with data.frame

2014-03-15 Thread Jeff Newmiller
It is not order that you are having difficulty with... it is name scope. Your "z" is not a standalone variable, but a column in your "t" data frame. Try t[order(t$z), ] Note that "t" is the name of a commonly-used function in R that transposes matrices. It is generally not a good idea to reuse

Re: [R] Help using order with data.frame

2014-03-15 Thread Bert Gunter
Indeed you are -- the syntax for selecting columns of a data frame (or components from a list). Advice: Read "An Introduction to R" or online tutorial of your choice to learn proper syntax. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. In

[R] Help using order with data.frame

2014-03-15 Thread Jason Rupert
Evidently, I'm overlooking something simple.  I'm trying to used order with data.frame.   For example: t = data.frame(x = c(11,12,14), y = c(19,20,21), z = c(10,9,7)) t[order(z), ] Error in order(z) : object 'z' not found Thank you for any insights and advice provided. [[alternative