Learn R Programming

explore (version 1.3.4)

replace_na_with: Replace NA

Description

Replace NA values of a variable in a dataframe

Usage

replace_na_with(data, var_name, with)

Value

Updated dataframe

Arguments

data

A dataframe

var_name

Name of variable where NAs are replaced

with

Value instead of NA

Examples

Run this code
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