[R] "Conditional" average

R. Michael Weylandt michael.weylandt at gmail.com
Wed Apr 25 03:55:17 CEST 2012


In base R, you probably want either ave() or tapply() (depending on
how you want your results formatted) for a quick and dirty solution.
aggregate() will get you there and allow more powerful transformations
with a little more work. All of these have examples in the help pages
that should get you started.

Michael

On Tue, Apr 24, 2012 at 9:23 PM, kebrab67 <selamgetachew at gmail.com> wrote:
> Hello, I have a set of data including age, wage and education level each
> called age76, wage76 and grade76 I want to know how i can calculate the
> average wage of people age 15 to 65 (each year separetly) , only for those
> who have an education level of 10 12 and 16...
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Conditional-average-tp4585313p4585313.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list