Density, distribution function, quantile function, and random generation from data.

qdata(formula, p = seq(0, 1, 0.25), data = NULL, ...)

cdata(formula, p = 0.95, data = NULL, ...)

pdata(formula, q, data = NULL, ...)

rdata(formula, n, data = NULL, ...)

ddata(formula, q, data = NULL, ...)

## Arguments

formula

a formula or a vector

p

a vector of probabilities

data

a data frame in which to evaluate formula

...

additional arguments passed to quantile or sample

q

a vector of quantiles

n

number of values to sample

## Value

For qdata, a vector of quantiles

for cdata, a data frame giving upper and lower limits and the central proportion requested

For pdata, a vector of probabilities

For rdata, a vector of sampled values.

For ddata, a vector of probabilities (empirical densities)

## Examples

data(penguins, package = "palmerpenguins")
qdata(flipper_length_mm ~ species, 0.5, data = penguins)
#>     species 50%
#> 2 Chinstrap 196
#> 3    Gentoo 216
qdata( ~ flipper_length_mm, p = 0.5, groups = species, data = penguins)
#>     species 50%
#> 2 Chinstrap 196
#> 3    Gentoo 216
qdata(penguins$flipper_length_mm, p = 0.5) #> 50% #> 197 qdata( ~ flipper_length_mm, p = 0.5, data = penguins) #> 50% #> 197 qdata( ~ flipper_length_mm, p = 0.5, groups = species, data = penguins) #> species 50% #> 1 Adelie 190 #> 2 Chinstrap 196 #> 3 Gentoo 216 data(penguins, package = 'palmerpenguins') cdata(penguins$flipper_length_mm, 0.5)
#>     lower upper central.p
#> 25%   190   213       0.5
cdata( ~ flipper_length_mm, 0.5, data = penguins)
#>     lower upper central.p
#> 25%   190   213       0.5
cdata( ~ flipper_length_mm, 0.5, data = penguins)
#>     lower upper central.p
#> 25%   190   213       0.5
cdata( ~ flipper_length_mm | species, data = penguins, p = .5)
#>     species lower upper central.p
#> 1    Adelie   186   195       0.5
#> 2 Chinstrap   191   201       0.5
#> 3    Gentoo   212   221       0.5
data(penguins, package = 'palmerpenguins')
pdata(penguins$flipper_length_mm, 3:6) #> [1] 0 0 0 0 pdata( ~ flipper_length_mm, 3:6, data = penguins) #> [1] 0 0 0 0 data(penguins, package = 'palmerpenguins') rdata(penguins$species, 10)
rdata( ~ species, n = 10, data = penguins)