Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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