Hi:
Summary:
I am trying to determine the 90th percentile of ambulance response times for
groups of data.
Background:
A fire chief would like to look at emergency response times at the 90th
percentile for 1 kilometer grids in Cape Coral, Florida. I have mapped out
ambulance response times on
1) tapply will work for quantile, but the syntax was a little off: try this
tapply(Cape $ ResponseTime, Cape $ Grid_ID, quantile, c(0.05, 0.95))
The fourth argument is additional parameters passed to the function
FUN which here is quantile. You could also do this
tapply(Cape $ ResponseTime, Cape
There's a slight variant that might be even more helpful if you need
to line the data up with how you started: ave(). I'll let you work out
the details, but the key difference is that it returns a vector that
has the 90th percentile for each group, each time that group appears,
instead of the
David:
You need to re-read ?tapply _carefully_. Note that:
FUN the function to be applied, or NULL. In the case of functions
like +, %*%, etc., the function name must be backquoted or quoted.
Now note that in tapply(whatever, byfactor, mean), mean _is_ a function.
However in tapply
4 matches
Mail list logo