Nothing
map <- function(.x, .f, ...) {
if (is.function(.f)) {
lapply(.x, .f, ...)
} else {
lapply(.x, `[[`, .f, ...)
}
}
map_mold <- function(.x, .f, .value, ...) {
out <- if (is.function(.f)) {
vapply(.x, .f, FUN.VALUE = .value, USE.NAMES = FALSE, ...)
} else {
vapply(.x, `[[`, .f, FUN.VALUE = .value, USE.NAMES = FALSE, ...)
}
stats::setNames(out, names(.x))
}
map_lgl <- function(.x, .f, ...) {
map_mold(.x, .f, NA, ...)
}
map_int <- function(.x, .f, ...) {
map_mold(.x, .f, NA_integer_, ...)
}
map_dbl <- function(.x, .f, ...) {
map_mold(.x, .f, NA_real_, ...)
}
map_chr <- function(.x, .f, ...) {
map_mold(.x, .f, NA_character_, ...)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.