dat1[order(dat1$val), ]

unless you used attach(dat1).


Sarah

On Tue, Mar 25, 2014 at 2:36 PM, John Kane <jrkrid...@inbox.com> wrote:
> Has there been a change in the syntax for order() or am I just making some 
> stupid mistake here?
>
> dat1 <-read.table(text="
> name val
> Alex 4
> Jim 10
> Fred 8
> Julie 44
> ",sep="",header=TRUE,stringsAsFactors=FALSE)
> dat1[order(val), ]  # Gives Error in order(val) : object 'val' not found
>
> dat1[order(dat1[,2]), ] # Works just fine.
>
> John Kane
> Kingston ON Canada
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
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