[R] Split dataset as factor and numeric

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed Apr 27 15:05:31 CEST 2005


Jan Sabee wrote on 4/27/2005 5:58 AM:
> Dear all,
> If I have dataset like,
> A1    25
> B     2
> AA    0
> C     0
> A1    1
> B     3
> A1    0
> C     3
> B     0
> A1    45
> A1    7
> C     0
> B     0
> A1    0
> B     6
> B     3
> 
> Is there any function to split like,
> A1    25
> A1    1
> A1    0
> A1    45
> A1    7
> A1    0
> 
> or 
> 
> AA    0
> C     0
> A1    0
> B     0
> B     0
> C     0
> B     0
> A1    0
> 
> Thanks,
> Jan Sabee
> 

Jan,

?subset

subset(x, V1 == "A1")
subset(x, V2 == 0)

HTH,

--sundar




More information about the R-help mailing list