s-news
[Top] [All Lists]

Applying vector functions to dataframes

To: <s-news@lists.biostat.wustl.edu>
Subject: Applying vector functions to dataframes
From: "Eric Turkheimer" <ent3c@virginia.edu>
Date: Mon, 25 Jul 2005 16:27:48 -0400
Importance: Normal

I have a fairly simple function that takes two vectors as arguments with a scalar result.  I would like to apply it pairwise to all the columns in a large dataset, resulting in a symmetrical matrix.  (The situation is analogous to using a function that computes the covariance between two vectors to produce the covariance matrix of a dataset).  I have written a function to do this using lapply, but on large (80 vars, 3000 subjects) datasets it is very very slow and sometimes runs out of memory entirely.  This must come up all the time.  Is there a standard best practice?

 

Thanks,

Eric

 

Eric Turkheimer, PhD
Department of Psychology
University of Virginia
PO Box 400400
Charlottesville, VA  22904-4400

434-982-4732
434-982-4766 (FAX)

 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.4/57 - Release Date: 7/22/2005

<Prev in Thread] Current Thread [Next in Thread>