[R] Mean(s) from values in different row?
David Winsemius
dwinsemius at comcast.net
Fri Oct 7 14:49:17 CEST 2011
On Oct 7, 2011, at 2:45 AM, Petr PIKAL wrote:
> Hi
>
>>
>> Hello:
>>
>> Is there a way to get a mean from values stored in different rows?
>>
>> The data looks like this:
>> YEAR-1, JAN, FEB, ..., DEC
>> YEAR-2, JAN, FEB, ..., DEC
>> YEAR-3, JAN, FEB, ..., DEC
The details of datA entry may need to be fleshed out. MORE SPEFIC ADVICE
>>
>> What I want is the mean(s) for just the consecutive winter months:
>> YEAR-1.DEC, YEAR-2.JAN, YEAR-2.FEB
>> YEAR-2.DEC, YEAR-3.JAN, YEAR-3.FEB
>> etc.
>
> Isn't colMean(yourdata) what you want?
Perhaps:
colMeans( dat[ , c("JAN", "DEC", "FEB")] )
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list