Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
Last active August 29, 2015 14:27
Show Gist options
  • Save mojaveazure/cfce100bbdca51a04812 to your computer and use it in GitHub Desktop.
Save mojaveazure/cfce100bbdca51a04812 to your computer and use it in GitHub Desktop.
Some R functions that I've found useful
#!/usr/bin/env Rscript
# bootstrap
# A function to bootstrap some data
bootstrap <- function(tmp.data) {
boot.rep <- sample(x = tmp.data, replace = T)
return(mean(boot.rep))
}
# push
# A function to append to a vector
push <- function(l, x) {
assign(x = l, value = append(x = eval(as.name(x = l)), values = x), envir=parent.frame())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment