bradleyd wrote

Thanks for your help Pete. I can almost get it to work with;

> by(day,year,quantile)

but this only gives me 0% 25% 50% 75% 100%, not the ones I'm looking for, 10% and 90%.

I have tried;

> by(day,year,quantile(c(0.1, 0.9))) but this is rejected by

Error in FUN(X[[1L]], ...) : could not find function "FUN"

Need to add the quantiles of interest .....

# Dummy Data

d <- data.frame(year=c(rep(2010,10),rep(2011,10),rep(2012,10)), quantity = c(1:30))

# Quantiles by Year

by(d$quantity,d$year,quantile,c(0.1,0.9))

HTH

Pete