s-news
[Top] [All Lists]

tapply() on columns of matrix

To: s-news@lists.biostat.wustl.edu
Subject: tapply() on columns of matrix
From: "Eric Turkheimer" <ent3c@virginia.edu>
Date: Tue, 19 Dec 2006 09:14:55 -0500
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=JeSVTlUAQp7GGr8oSV359pEgZl/X/2T258J8h1JrxFDD11v2ufy9EIHkw1/mAf4FQlJbxf1KvRMd3hK/5ST7wS/7wRG4f80tpZp17BH1rkw3wWzlo6ziNmLiEbAWvu2Foic1XgkU8ucKBFjDDEkwv9jXxZX/UNX2odv7n78bthA=
I have a matrix with three columns.  I would like to compute the covariance between the first two, separately according to values of the third.  The best I can figure out is to split the matrix up into a list using split(), and then use sapply().  I was wondering if there was a more direct way.  A little more generally, how can you use tapply to evaluate bivariate functions?

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)
<Prev in Thread] Current Thread [Next in Thread>