knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of flatcat is to provide flat map functions.
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("DavisVaughan/flatcat")
No size 1 restriction in each .f
call
library(flatcat) library(purrr) map_dbl(list(1, 2:3, 4:6), ~.x) flat_map_dbl(list(1, 2:3, 4:6), ~.x)
A neat (but fairly inefficient) way to interleave vectors
flat_map2_dbl(1:5, 6:10, ~c(.x, .y))
With data frames
flat_map_dfr(list(1, 2:3, 4:6), ~data.frame(x = .x)) flat_map_dfc( list(1, 2:3, 4, 5:6), ~{ name <- paste0("x_", paste0(.x, collapse = "_")) tibble::tibble(!! name := .x) } )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.