powered by
dplyr::case_when()
NA
A thin wrapper of dplyr::case_when() if there are NAs
case_na(formula)
A two-sided formula. The LHS expects a vector containing NA, and the RHS gives the replacement value.
dplyr::case_when
# 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