Learn R Programming

tidytable (version 0.5.1)

replace_na.: Replace missing values

Description

A shortcut to replace NAs inside of a mutate.() call.

Note: This function does not work outside of mutate.() like tidyr::replace_na() does.

Usage

replace_na.(.col, replace)

dt_replace_na(.col, replace)

Arguments

.col

A vector

replace

A single value used for replacement

Examples

Run this code
# NOT RUN {
test_df <- data.table(
  x = c(1, 2, NA),
  y = c(NA, 1, 2))

test_df %>%
  mutate.(x = replace_na.(x, 5))
# }

Run the code above in your browser using DataLab