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)