Last active
August 29, 2015 14:27
-
-
Save mojaveazure/cfce100bbdca51a04812 to your computer and use it in GitHub Desktop.
Some R functions that I've found useful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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