Thanks a lot, Steve! match sounds very promising - that means I only need a loop across predictors.
As far as "get more memory" advice is concerned: I already have "more" memory :) On Wed, Jan 11, 2012 at 11:14 AM, Steve Lianoglou <mailinglist.honey...@gmail.com> wrote: > Hi, > > On Wed, Jan 11, 2012 at 10:50 AM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> Thanks a lot, Steve. I have one question (below): >> >> >>> ==== >>> library(data.table) >>> >>> ## your data >>> xx <- data.table(group=c(rep("group1",5),rep("group2",5)), >>> a=1:10, b=seq(10,100,by=10), key="group") >>> yy <- data.table(group=c("group1","group2"), a=c(10,20), b=c(2,3), >>> key="group") >>> >>> ## temp data.table to get your ducks in a row >>> m <- merge(xx, yy, by="group", suffixes=c(".x", ".y")) >> >> >> Dimitri: The step above (merge) - I was thinking of it but decided >> against it because my xx already fills up tons of memory. When I merge >> xx and yy that doubles the number of variables - I am afraid my memory >> won't hold that much stuff... > > Fair enough ... how about just using `match`, then, ie: > > R> aa <- x$a * y$a[match(x$group, y$group)] > > Should do the trick, no? > > -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 -- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ R-help@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.