RでDataFrameからFactorに基づいて、特定のインデックスや、ローを抽出する

○ Extracting indices from data frame by factor.


which(df$b %in% factor(c("a","e"))


○ subset data frame by factor.


subset(df , b %in% c("a","e"))
# b : column name, a,e : factors you want to select


%in% operator is useful in this case.
%in% seems to be able to compare factors and character (vecs).


http://stat.ethz.ch/R-manual/R-patched/library/base/html/match.html