[R] Quantiles of a subset of data
Pete Brecknock
Peter.Brecknock at bp.com
Tue Feb 19 16:52:59 CET 2013
bradleyd wrote
> Excuse the request from an R novice! I have a data frame (DATA) that has
> two numeric columns (YEAR and DAY) and 4000 rows. For each YEAR I need to
> determine the 10% and 90% quantiles of DAY. I'm sure this is easy enough,
> but I am a new to this.
>
>> quantile(DATA$DAY,c(0.1,0.9))
> 10% 90%
> 12 29
>
> But this is for the entire 4000 rows, when I need it to be for each YEAR.
> Is there no way to use a "by" argument in the quantile function?
>
> Thanks for any help you can provide.
> David
check out
?aggregate or ?by should be of help
HTH
Pete
--
View this message in context: http://r.789695.n4.nabble.com/Quantiles-of-a-subset-of-data-tp4659063p4659064.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list