Skip to content

Instantly share code, notes, and snippets.

@dholstius
Created September 22, 2014 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dholstius/d50d48ec40dac1adc67e to your computer and use it in GitHub Desktop.
Save dholstius/d50d48ec40dac1adc67e to your computer and use it in GitHub Desktop.
lapply() mixed with rbind()
rbindapply <- function (
X,
FUN,
...
) {
results <- lapply(X, FUN, ...)
if (!is.null(names(X))) {
names(results) <- names(X)
} else {
if (is.character(X))
names(results) <- X
}
do.call(rbind, results)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment