#' @title A bootstrap samples generator using R
#' @description A function for generating bootstrap samples of given data using R
#' @param X the given set of one-dimension data
#' @param n the number of bootstraping
#' @return a matrix of samples generated by bootstraping and the row of the sample matrix is \code{n}
#' @examples
#' \dontrun{
#' X <- c(96,87,88,90,85)
#' outer <- bootstrapR(X, 10)
#' }
#' @export
bootstrapR <- function(X, n) {
m <- length(X)
out <- matrix(nrow = n, ncol = m)
for(i in 1:n){
out[i,] <- sample(X, m, replace = TRUE)
}
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.