[R] Syntax for order()

John Kane jrkrideau at inbox.com
Tue Mar 25 19:36:38 CET 2014


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

____________________________________________________________
Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4



More information about the R-help mailing list