na_to_zero_df: NA to Zeros

Description Usage Arguments Examples

View source: R/na_to_zero_df.R

Description

Specify a dataframe and a vector of column names. If there are NAs in those columns, convert them to 0s and return a dataframe. This is slower than using na_to_zero.R with purrr:: map().

Usage

1

Arguments

df

A dataframe.

cols

A vector of quoted column names.

...

Other arguments

Examples

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

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