Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replace_na.tbl_lazy

Replace NAs with specified values


Description

This is a method for the tidyr::replace_na() generic.

Usage

replace_na.tbl_lazy(data, replace = list(), ...)

Arguments

data

A pair of lazy data frame backed by database queries.

replace

A named list of values, with one value for each column that has NA values to be replaced.

...

Unused; included for compatibility with generic.

Value

Another tbl_lazy. Use show_query() to see the generated query, and use collect() to execute the query and return data to R.

Examples

if (require("tidyr", quietly = TRUE)) {
  df <- memdb_frame(x = c(1, 2, NA), y = c("a", NA, "b"))
  df %>% replace_na(list(x = 0, y = "unknown"))
}

dbplyr

A 'dplyr' Back End for Databases

v2.1.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Maximilian Girlich [aut], Edgar Ruiz [aut], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.