[R] fast or space-efficient lookup?

Matthew Dowle mdowle at mdowle.plus.com
Mon Oct 10 18:27:16 CEST 2011


Ivo,

Also, perhaps FAQ 2.14 helps : "Can you explain further why
data.table is inspired by A[B] syntax in base?"

http://datatable.r-forge.r-project.org/datatable-faq.pdf

And, 2.15 and 2.16.

Matthew

"Steve Lianoglou" <mailinglist.honeypot at gmail.com> wrote in message 
news:CAHA9McPQ4P-a2imjm=szgjFxyx0Faw0J79fwq2E87dQkF9JpVw at mail.gmail.com...
Hi Ivo,

On Mon, Oct 10, 2011 at 10:58 AM, ivo welch <ivo.welch at gmail.com> wrote:
> hi steve---agreed...but is there any other computer language in which
> an expression in a [ . ] is anything except a tensor index selector?

Sure, it's a type specifier in scala generics:
http://www.scala-lang.org/node/113

Something similar to "scale-eez" in haskell.

Aslo, MATLAB (ugh) it's not even a tensor selector (they use "normal"
parens there).

But I'm not sure what that has to do w/ the price of tea in china.

With data.table, "[" still is "tensor-selector" like, though. You can
just pass in another data.table to use as the "keys" to do your
selection through the `i` argument (like "selecting rows"), which I
guess will likely be your most common use case if you're moving to
data.table (presumably you are trying to take advantage of its
quickness over big-table-like objects.

You can use the `j` param to further manipulate columns. If you pass
in a data.table as `i`, it will add its columns to `j`.

I'll grant you that it is different than your standard "rectangular
object" selection in R, but the motivation isn't "so strange" as both
i,j params in normal calls to 'xxx[i,j]' are for selecting (ok not
manipulating) rows and columns on other "rectangular" like objects,
too.

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-help mailing list