[R] Querying a data frame or data.table

Michael Bedward michael.bedward at gmail.com
Fri Dec 3 09:44:22 CET 2010


Sounds just like the subset function (?)

x <- as.data.frame(matrix(sample(5, 100, rep=TRUE), ncol=10))
subset(x, V1 > 3 & V2 < 5)

Michael

On 3 December 2010 19:05, Santosh Srinivas <santosh.srinivas at gmail.com> wrote:
> Hello Group,
>
> Is there an easy way to query a data.frame or data.table (this is
> fast!) for multiple conditions?
> I don't want to use a SQL kind of statement.
>
> I am looking for something like a subset with multiple conditions.
>
> Any tips of the like the binary search methodology used for data.table
> would also help.
>
> Thanks in advance.
> S
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list