R/sample_mean.R

Defines functions sample_mean

Documented in sample_mean

#' take as input a vector vec and an integer n. 
#' It should take a random sample of size n from vec, 
#' then calculate and return the mean of that subsample.
#'
#' @param n An integer
#' @param vec A vector
#'
#' @return an int, mean of subsample
#'
#' @import stringr
#' @import glue
#' @import dplyr
#' @import purrr
#'
#' @export


sample_mean <- function(vec, n){
  sub_sample <- sample(vec, n, replace = TRUE)
  return (mean(sub_sample))
}
elainesabine/stats331lab7 documentation built on Dec. 20, 2021, 4:15 a.m.