set_na_zero: Set NA values in an integer or numeric vector to zero.

Description Usage Arguments Value Examples

View source: R/short_generic.R

Description

Useful for converting NA values to zero when computing summary counts

Usage

1

Arguments

x

an integer or numeric vector

Value

A vector x of integers or numeric values equal to 0. Use subsetting to apply function to only numeric or integer values.

Examples

1
2
3
4
5
6
# Create example dataframe
fish_zero = tibble::tibble(fish_count = c(4L, NA, 5L),
                           water_temp = c(5.4, 6.2, NA))

# Set missing values to zero
fish_zero[] = lapply(fish_zero, set_na_zero)

arestrom/remisc documentation built on July 16, 2020, 8:48 a.m.