Re: [R] Manipulating matrices

From: jim holtman <jholtman_at_gmail.com>
Date: Wed 14 Dec 2005 - 09:00:04 EST

aggregate(x$varA, by=list(x$year, x$name), mean)

On 12/13/05, SÚrgio Nunes <snunes@gmail.com> wrote:
>
> Hi,
>
> I'm pretty new to R and I've been having some problems filtering data
> in matrices.
>
> I have the following initial dataset:
>
> || year | name | varA ||
>
> I have multiple values for "varA" for the same "year" and the same "name".
> Having this as the input I would like to obtain the following:
>
> || year | name | {varA mean} ||
>
> Where I only have one line for each "year" and "name" with the mean of
> the values of "varA" in "varA mean".
>
> Is there a simple way to achieve this without using control structures
> (for or while cycles)?
>
> Thanks in advance for any help.
>
> Best regards,
> SÚrgio Nunes
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

	[[alternative HTML version deleted]]


______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Received on Wed Dec 14 10:19:01 2005

This archive was generated by hypermail 2.1.8 : Wed 14 Dec 2005 - 14:38:34 EST