Bootstrap function
The first iteration of the bootstrap function was due 4/9
Second iteration due 5/14
Here is what I was looking for initially:
Your function should take two arguments, a numeric vector of data and a number of samples (which should default to 1000), and return a bootstrap distribution of the mean of that variable, with a vertical line at the original mean. If a non-numeric vector is passed, the function should return the error “var must be a numeric vector”
For the second iteration, I would like a second .R file in the same GitHub repo as before. You can name that .R file whatever you would like, but I’d like the function to be called tidybootstrap
.
I would like your tidybootstrap
function to take three arugments: a dataset, a variable name, and a number of samples (which should default to 1000) and return a bootstrap distribution of the mean of that variable, with a vertical line at the original mean. If a non-numeric variable is passed, the function should return the error “var must be a numeric vector.”
- Code should be formatted in accordance with the tidyverse style guide. The easiest way to do this is with the add-in for the
styler
package. - Use
stop()
to throw the error. - Document the function (can just edit documentation from the previous function so it describes how the function now operates)
- Include examples in the documentaiton (can just edit examples from the previous function so they show how the function now operates, e.g.
mtcars %>% tidybootstrap(mpg, samples = 500)
)