[R] Querying a data frame or data.table

2010-12-03 Thread Santosh Srinivas
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

Re: [R] Querying a data frame or data.table

2010-12-03 Thread Michael Bedward
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.srini...@gmail.com wrote: Hello Group, Is there an easy way to query a data.frame or data.table (this is

Re: [R] Querying a data frame or data.table

2010-12-03 Thread Dieter Menne
mbedward wrote: Sounds just like the subset function (?) .. Or try sqldf if you feel at home in the SQL empire. Dieter -- View this message in context: http://r.789695.n4.nabble.com/Querying-a-data-frame-or-data-table-tp3070750p3070926.html Sent from the R help mailing list archive

Re: [R] Querying a data frame or data.table

2010-12-03 Thread David Winsemius
On Dec 3, 2010, at 3:44 AM, Michael Bedward wrote: Sounds just like the subset function (?) x - as.data.frame(matrix(sample(5, 100, rep=TRUE), ncol=10)) subset(x, ) With data,table: require(data.table) xd - as.data.table(x) xd[ V1 3 V2 5 , ] V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 [1,] 4