View source: R/btools_dplyrtools.r
qtiledf | R Documentation |
qtiledf
get quantiles and number of not-NA observations for a vector, return as data frame
qtiledf(vec, probs)
vec |
Numeric vector. No default. |
probs |
Numeric vector of quantiles. Default is c(0, .1, .25, .5, .75, .9, 1). |
Very little error checking. Useful after dplyr's group_by, in do command, which requires data frame input.
Data frame with columns as quantiles
library(dplyr) df <- tibble(year=c(rep(1, 5), rep(2, 7)), x=c(seq(1, 2, length.out=11), NA)) df df %>% group_by(year) %>% summarise(qtiledf(.$x, c(.1, .25, .5, .75, .9)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.