[R] locate the rows in a dataframe with some criteria

Henrique Dallazuanna wwwhsd at gmail.com
Fri Mar 7 17:03:42 CET 2008


Try:

with(m, which((x >= 10 & y == "A")))

On 07/03/2008, zhihuali <lzhtom at hotmail.com> wrote:
>
>  Hi, netters,
>
>  This is probably a rookie question but I couldn't find the answer after hours of searching and trying.
>
>  Suppose there'a a dataframe M:
>
>  x     y
>  10   A
>  13   B
>  8     A
>   11   A
>
>  I want to locate the rows where x >=10 and y="A". I know how to do it to vectors by using
>  which, but how to do it with the dataframe?
>
>  Thank you very much!
>
>
>  Zhihua Li
>
>
>  _________________________________________________________________
>  MSN 中文网,最新时尚生活资讯,白领聚集门户。
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
>  R-help at r-project.org 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.
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O


More information about the R-help mailing list