#' each
#'
#' @param l list
#' @param fun function
#' @param ungroup boolean wether to ungroup result or not
each <- function(l, fun, ungroup=FALSE) {
if(is.data.frame(l)) {
l <- split(l, 1:nrow(l))
}
m <- lapply(l, fun)
if(!ungroup) {
return(m)
} else {
return(m %>% ungroup)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.