Update/Replace Values in Dataframe with Tidyverse Join
Clash Royale CLAN TAG #URR8PPP Update/Replace Values in Dataframe with Tidyverse Join What is the most efficient way to update/replace NAs in main dataset with (correct) values in a lookup table? This is such a common operation! Similar questions do not seem to have tidy solutions. Constraints: 1) Please assume a large number of missing values and bigger lookup table than the example given. So case-wise replacement operations would be impractical (no case_when , if_else , etc.) case_when if_else 2)The lookup table does not have all values of main dataframe, only the replacement ones. Tidyverse solution answer much preferred. Similar questions do not seem to have tidy solutions. library(tidyverse) ### Main Dataframe ### df1 <- tibble( state_abbrev = state.abb[1:10], state_name = c(state.name[1:5], rep(NA, 3), state.name[9:10]), value = sample(500:1200, 10, replace=TRUE) ) #> # A tibble: 10 x 3 #> state_abbrev state_name value #> <chr> <chr> ...