[R] alternative to matching/merge?

Lana Schaffer schaffer at scripps.edu
Fri Jun 13 18:03:00 CEST 2008


Jim,
My code is this:
 mergefunc <- function(x,seqFile){
#     merge(seqFile,x)
cbind(x, seqFile[ match(as.vector(x$index), as.vector(seqFile$index)),
])
}
LIX <- lapply(d.frame[[1]], mergefunc,seqFile=seqFile)
Each matrix/data.frame takes 0.2 seconds and then to do this
1240 times takes ~4 minutes.
Thanks,
Lana

-----Original Message-----
From: jim holtman [mailto:jholtman at gmail.com] 
Sent: Thursday, June 12, 2008 6:40 PM
To: Lana Schaffer
Cc: r-help at r-project.org
Subject: Re: [R] alternative to matching/merge?

It would be nice if you at least included the code that you are using
and a subset of the data.  Have you run Rprof to determine which of the
functions is consuming the time?

On Thu, Jun 12, 2008 at 3:25 PM, Lana Schaffer <schaffer at scripps.edu>
wrote:
>
> Greetings,
> I am doing matching/merge for a table (40919x3) to data which is in 
> the form of a list of 1268 data.frames.  Using lapply this is taking 
> ~5 minutes.  I know that the match/merge functions are time consuming,

> so is there an alternative to this accomplish this goal?  is lapply 
> not efficient?
>
> Lana Schaffer
> Biostatistics/Informatics
> The Scripps Research Institute
> DNA Array Core Facility
> La Jolla, CA 92037
> (858) 784-2263
> (858) 784-2994
> schaffer at scripps.edu
>
> ______________________________________________
> 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.
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list