powered by
Replace NA values of a variable in a dataframe
replace_na_with(data, var_name, with)
Updated dataframe
A dataframe
Name of variable where NAs are replaced
Value instead of NA
data <- data.frame(nr = c(1,2,3,NA,NA)) replace_na_with(data, "nr", 0)
Run the code above in your browser using DataLab