calculate_sample_means: Calculating sample means from a population

Description Usage Arguments Value Examples

View source: R/stat.R

Description

According to the central limit theorem, the mean of the samples taken from a population would be normally distributed regardless of the distribution of the population.

Usage

1
calculate_sample_means(x, n, size, replace = FALSE, na.rm = TRUE)

Arguments

x

an atomic numeric vector.

n

number of samples to be taken.

size

sample size to choose.

replace

should sampling done with replacement? default value is FALSE.

na.rm

remove NAs when calculating arithmetic mean. default value is TRUE.

Value

This function takes n number of samples with a size of size and returns a vector with a length of n.

Examples

1
2
data <- runif(1e3)
sm <- calculate_sample_means(data, 1e2, 40) # now look at the hist(sm)

strboul/mmy documentation built on Sept. 24, 2021, 12:08 p.m.