How to nest quantile() function within apply() function in R or RStudio
Asked Answered
T

1

13

How can I nest a quantile() within a tapply() in R Studio?

Given:

tapply(data$x,data$y, quantile)

This works, but it delivers standard quin-tiles. I want to choose custom percentiles. How can I incorporate something like this (below) into the above line of script?

quantile(data$x, c(0.1,.2,.8,0.9), na.rm=TRUE)

When I attempt to merge these, I receive the error message "match.fun(FUN)...not a function"

Any ideas? Thanks,

Transversal answered 24/11, 2014 at 14:30 Comment(0)
V
14

tapply(data$x, data$y, quantile, probs=c(0.1,.2,.8,0.9), na.rm=TRUE) ?

Vite answered 24/11, 2014 at 14:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.