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 names like that, but it can 
be puzzling to avoid when you are new. I type the name of the variable I want 
to create alone on an interactive R console before I create it... if it tells 
me that variable is not defined then I proceed.

You should also avoid posting HTML email to this list, as what we see is often 
not what you see. Read the Posting Guide for more useful advice on using the 
list.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On March 15, 2014 9:21:41 PM PDT, Jason Rupert <jasonkrup...@yahoo.com> 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), ]
>Error in order(z) : object 'z' not found
>
>Thank you for any insights and advice provided. 
>       [[alternative HTML version deleted]]
>
>
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to