Skip to content
Back to formatted view

Raw Message

Message-ID: <BF1E59A7.C0C0%sdavis2@mail.nih.gov>
Date: 2005-08-09T17:01:27Z
From: Sean Davis
Subject: numeric operations w/ lists
In-Reply-To: <6BCB4D493A447546A8126F24332056E8F289B8@school1.business.edu>

On 8/9/05 12:21 PM, "Afshartous, David" <afshart at exchange.sba.miami.edu>
wrote:

> 
> Hello all,
> 
> X is a list of 20 lists, and each individual list has 65 elements.
> 
> Y is a list of 65 elements.
> 
> WANT:  subtract Y from each of the 20 lists in X.
> 
> Here's what I tried and the error messages:
> 
>> X - rep(Y, 20)

See ?lapply.  Something like:


NewX <- lapply(X,function(tmp) {tmp-Y})

Hope this helps.

Sean