[R] Syntax for order()
John Kane
jrkrideau at inbox.com
Tue Mar 25 19:42:00 CET 2014
I "knew" it was almost certainly something really stupid.
Thanks very much.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: sarah.goslee at gmail.com
> Sent: Tue, 25 Mar 2014 14:40:50 -0400
> To: jrkrideau at inbox.com
> Subject: Re: [R] Syntax for order()
>
> dat1[order(dat1$val), ]
>
> unless you used attach(dat1).
>
>
> Sarah
>
> On Tue, Mar 25, 2014 at 2:36 PM, John Kane <jrkrideau at 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
____________________________________________________________
Protect your computer files with professional cloud backup.
Get PCRx Backup and upload unlimited files automatically.
Learn more at http://backup.pcrx.com/mail
More information about the R-help
mailing list