[R] unexpected subset select results?

ivo welch ivo.welch at gmail.com
Tue Aug 24 00:15:43 CEST 2010


I would not have wanted a data set with 1000 variables, but an error
message.  the intent was

   d=data.frame( a=1:1000, b=2001:3000, z= 5001:6000 )
   attach(d); d$c <- (a+b)>25; detach(d)
   d= subset(d, TRUE, select=c( a, b, c ))

-iaw


On Mon, Aug 23, 2010 at 6:04 PM, Erik Iverson <eriki at ccbr.umn.edu> wrote:
>
>
> ivo welch wrote:
>>
>> quizz---what does this produce?
>>
>>   d=data.frame( a=1:1000, b=2001:3000, z= 5001:6000 )
>>   attach(d); c <- (a+b)>25; detach(d)
>>   d= subset(d, TRUE, select=c( a, b, c ))
>>
>> yes, I know I have made a mistake, in that the code does not do what I
>> presumably would have wanted.
>
> What exactly did you want?
>



More information about the R-help mailing list