View source: R/empirical_dist.R
| rmap.empirical_dist | R Documentation |
empirical_dist object x.Method for obtaining the empirical distribution of a function of the
observations of empirical_dist object x.
## S3 method for class 'empirical_dist'
rmap(x, g, ...)
x |
The empirical distribution object. |
g |
The function to apply to each observation. |
... |
Additional arguments to pass into function |
An empirical_dist of the transformed observations.
ed <- empirical_dist(c(1, 2, 3, 4))
ed2 <- rmap(ed, function(x) x^2)
mean(ed2) # mean of 1, 4, 9, 16
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.