powered by
f
x
Generic method for applying a map f to distribution object x.
rmap(x, g, ...)
A distribution representing the push-forward of x through g.
g
The distribution object.
The function to apply.
Additional arguments to pass into g.
# \donttest{ d <- empirical_dist(1:20) d_sq <- rmap(d, function(x) x^2) mean(d_sq) # E[X^2] for uniform 1..20 # }
Run the code above in your browser using DataLab