Learn R Programming

tsibble (version 0.5.3)

case_na: A thin wrapper of dplyr::case_when() if there are NAs

Description

A thin wrapper of dplyr::case_when() if there are NAs

Usage

case_na(formula)

Arguments

formula

A two-sided formula. The LHS expects a vector containing NA, and the RHS gives the replacement value.

See Also

dplyr::case_when

Examples

Run this code
# NOT RUN {
x <- rnorm(10)
x[c(3, 7)] <- NA_real_
case_na(x ~ 10)
case_na(x ~ mean(x, na.rm = TRUE))
# }

Run the code above in your browser using DataLab