na_to_zero: NA to Zeros

Description Usage Arguments Examples

View source: R/na_to_zero.R

Description

An alternative to na_to_zero_df(). Use purrr::map() instead.

Usage

1

Arguments

val

A value.

Examples

1
2
3
4
5
6
7
8
sample_df <- list(a = c(1:2, NA),
                  b = letters[1:3],
                  c = c(NA, "foo", "bar")) %>%
  tibble::as_tibble()
sample_df %>% purrr::map_df(na_to_zero)

cols_to_zero <- c("a", "b")
sample_df %>% purrr::map_at(na_to_zero, .at = cols_to_zero) %>% tibble::as_tibble()

aedobbyn/dobtools documentation built on May 28, 2019, 2:33 a.m.