[R] subset
Martin Becker
martin.becker at mx.uni-saarland.de
Fri May 4 09:29:41 CEST 2007
elyakhlifi mustapha wrote:
> hello,
>
>
>> subset(swiss, Agriculture > 60 & Examination != c(14,16), select = c(Agriculture,Examination,Catholic))
>>
Try %in% :
subset(swiss, Agriculture > 60 & Examination %in% c(14,16), select = c(Agriculture,Examination,Catholic))
Agriculture Examination Catholic
Broye 70.2 16 92.85
Glane 67.8 14 97.16
Veveyse 64.5 14 98.61
Aubonne 67.5 14 2.27
Rolle 60.8 16 7.72
Regards,
Martin
> Agriculture Examination Catholic
> Broye 70.2 16 3.30
> Glane 67.8 14 4.20
> Aigle 62.0 21 5.16
> Avenches 60.7 19 5.23
> Cossonay 69.3 22 5.62
> Echallens 72.6 18 6.10
> Lavaux 73.0 19 9.96
> Oron 71.2 12 16.92
> Paysd'enhaut 63.5 6 24.20
> Conthey 85.9 3 58.33
> Entremont 84.9 7 84.84
> Herens 89.7 5 90.57
> Martigwy 78.2 12 91.38
> Monthey 64.9 7 92.85
> St Maurice 75.9 9 93.40
> Sierre 84.6 3 96.83
> Sion 63.1 13 97.16
> Warning message:
> la longueur de l'objet le plus long
> n'est pas un multiple de la longueur de l'objet le plus court in: Examination != c(14, 16)
>
> As this example shows I'd like to know if it's possible to drop several lines for example here to drop severals lines from Examination
> thanks
>
>
>
> ___________________________________________________________________________
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list