Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```R
- #' Help to create a list for the argument `col_types` of [readr::read_csv()].
- #' @noRd
- cat_col_types <- function(x) {
- types <- purrr::map(x, class) %>%
- tibble::enframe() %>%
- tidyr::unnest() %>%
- dplyr::mutate(
- type = dplyr::case_when(
- value == "character" ~ "c",
- value == "integer" ~ "i",
- value == "numeric" ~ "d"
- ),
- type = paste0(name, " = '", type, "',")
- ) %>%
- dplyr::pull(type)
- cat(types)
- }
- ```
Add Comment
Please, Sign In to add comment