An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20030826/3dd33f8b/attachment.pl
Subsetting a dataframe
2 messages · a0203664@unet.univie.ac.at, Uwe Ligges
a0203664 at unet.univie.ac.at wrote:
Hi R-people
I have a question concerning subsetting. I have a dataframe which contains among other variables the variable "subject". For each subject number there are several rows, e.g.:
subject treatment concentration day
19 a 15,4 1
19 a 18,3 2
19 a 2,3 3
etc.
Im trying to subset the dataframe to get for example only the rows of subject 19 and subject 15. I tried this with
nameofdataframe[nameofdataframe$subject==c(19,15),]
This doesnt work as i get less rows than i should and a warning as well. How can i succeed doing this?
Thanks a lot
Gabi
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
See ?"%in%" as in nameofdataframe$subject %in% c(19,15) Uwe Ligges