# Import libaries
library(boot)
# Create sample dataframe
set.seed(1)
x <- rnorm(1000, sd=10)
y <- rnorm(1000, sd=1)
df <- data.frame(x,y)
# Create function to pass to boot()
calc_mean = function(data, index){
mean_x <- mean(df$x[index])
return(mean_x)
}
boot(df$x, calc_mean, R=1000)