[R] Subsetting dataframes

CG Pettersson cg.pettersson at vpe.slu.se
Thu Jul 19 16:20:07 CEST 2007


Thanks a lot.
But an ignorant R user, like me, needed the code example from Jim Holtman
posted outside the list earlier today to understand that:

x62_samvar$cn <- x62_samvar$cn[,drop=TRUE]

was the way to code. Thank you both!

/CG


On Thu, July 19, 2007 3:01 pm, Uwe Ligges said:
>
>
> CG Pettersson wrote:
>> Dear all!
>>
>> W2k, R 2.5.1
>>
>> I am working with an ongoing malting barley variety evaluation within
>> Sweden. The structure is 25 cultivars tested each year at four sites, in

/snip

>>
>> Where do I go wrong and how do I use subset in a proper way?
>
>
> So you have to drop the levels you are excluding. Example:
>
>    x <- factor(letters[1:4])
>    x
>    x[1:2]
>    x[1:2, drop=TRUE]
>
>
> Uwe Ligges
>
>
>
>
>> Thanks
>> /CG
>>
>


-- 
CG Pettersson, PhD
Swedish University of Agricultural Sciences (SLU)
Dept. of Crop Production Ecology. Box 7043.
SE-750 07 Uppsala, Sweden
cg.pettersson at vpe.slu.se



More information about the R-help mailing list