quantiles: Efficient quantiles

Description Usage Arguments Value Examples

View source: R/quantiles.R

Description

Produces quantiles of the variables. quantiles shows quantile values. Efficient with big data: if you give it a data.table, quantiles uses data.table syntax.

Usage

1
quantiles(df, ..., probs = seq(0, 1, 0.1), na.rm = FALSE)

Arguments

df

A data.table, tibble, or data.frame.

...

A column or set of columns (without quotation marks).

probs

numeric vector of probabilities with values in [0,1].

na.rm

logical; if true, any NA and NaN's are removed from x before the quantiles are computed.

Value

Quantile values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# data.table
library(data.table)
library(magrittr)
a <- data.table(varname = sample.int(20, size = 1000000, replace = TRUE))
a %>% quantiles(varname)

# data.table: look at top 10% in more detail
a %>% quantiles(varname, probs = seq(0.9, 1, 0.01))

# tibble
library(dplyr)
b <- tibble(varname = sample.int(20, size = 1000000, replace = TRUE))
b %>% quantiles(varname, na.rm = TRUE)

tabulator documentation built on Jan. 13, 2021, 12:56 p.m.