Learn R Programming

mosaic (version 1.9.1)

qdata: The Data Distribution

Description

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

Usage

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, ...)

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)

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

Examples

Run this code
data(penguins, package = "palmerpenguins")
qdata(flipper_length_mm ~ species, 0.5, data = penguins)
qdata( ~ flipper_length_mm, p = 0.5, groups = species, data = penguins)
qdata(penguins$flipper_length_mm, p = 0.5)
qdata( ~ flipper_length_mm, p = 0.5, data = penguins)
qdata( ~ flipper_length_mm, p = 0.5, groups = species, data = penguins)
data(penguins, package = 'palmerpenguins')
cdata(penguins$flipper_length_mm, 0.5)
cdata( ~ flipper_length_mm, 0.5, data = penguins)
cdata( ~ flipper_length_mm, 0.5, data = penguins)
cdata( ~ flipper_length_mm | species, data = penguins, p = .5)
data(penguins, package = 'palmerpenguins')
pdata(penguins$flipper_length_mm, 3:6)
pdata( ~ flipper_length_mm, 3:6, data = penguins)
data(penguins, package = 'palmerpenguins')
rdata(penguins$species, 10)
rdata( ~ species, n = 10, data = penguins)
rdata(flipper_length_mm ~ species,  n = 5, data = penguins)
data(penguins, package = 'palmerpenguins')
ddata(penguins$species, 'setosa')
ddata( ~ species, 'setosa', data = penguins)

Run the code above in your browser using DataLab