subset data right
Hello, Don't use subset, use indexing. subdf <- df[df$quant %in% "VeryFast", ] By the way, instead of %in% you can use ==, since you're interested in just one value of quant. Hope this helps, Rui Barradas Citando ch.elahe via R-help <r-help at r-project.org>:
Hi all,
I have the following df and I want to know which Protocols are
VeryFast, which are FAST, which are SLOW and also which ones are
VerySLOW :
$ Protocol? ? ? ?: Factor w/ 48 levels "DP FS QTSE SAG",..: 5 5 28 5
5 5 7 7 47 5 ...
$ quant? ? ? ? ? : Factor w/ 4 levels "FAST","SLOW",..: 2 2 2 4 2 1 1 2 4
I do the following subset but nothing is changed in my df:
subdf=subset(df,quant%in%c("VeryFast"))
subdf$quant=factor(subdf$quant)
and when I get the str(df) again Protocol has 48 levels. Does anyone
know how can I get these subsets right?
Thanks for any help!
Elahe
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
?