set.seed(42)
data <- matrix(rnorm(200), ncol = 2)
# sample mean with confidence interval
expectation_data(data)
# just the point estimate, no CI
expectation_data(data, compute_stats = FALSE)
# expectation of a function of the data (row-wise)
expectation_data(data, g = function(x) sum(x^2))
Run the code above in your browser using DataLab