rewrite_na {baizer}R Documentation

rewrite the NA values in a tibble by another tibble

Description

rewrite the NA values in a tibble by another tibble

Usage

rewrite_na(x, y, by)

Arguments

x

raw tibble

y

replace reference tibble

by

columns to align the tibbles

Value

tibble

Examples


tb1 <- tibble::tibble(
  id = c("id-1", "id-2", "id-3", "id-4"),
  group = c("a", "b", "a", "b"),
  price = c(0, -200, 3000, NA),
  type = c("large", "none", "small", "none")
)

tb2 <- tibble::tibble(
  id = c("id-1", "id-2", "id-3", "id-4"),
  group = c("a", "b", "a", "b"),
  price = c(1, 2, 3, 4),
  type = c("l", "x", "x", "m")
)

rewrite_na(tb1, tb2, by = c("id", "group"))

[Package baizer version 0.8.0 Index]