missing.fill.in: Fill in missing values in a dataframe with a secondary source

View source: R/missing.data.R

missing.fill.inR Documentation

Fill in missing values in a dataframe with a secondary source

Description

This function uses the (non-missing) values from one column to fill in the missing values of another

Usage

missing.fill.in(x, var.from, var.to)

Arguments

x

a dataframe or matrix

var.from

secondary variable (of the same type and units) providing values to 'var.to'

var.to

primary variable with missing values to fill in by 'var.from'

Value

a modified dataframe with fewer missing values in the 'var.to' column

Examples


df <- data.frame(a=c(1,2,NA),b=c(1,NA,3),c=c(1,2,6))
missing.fill.in(df, 'c','a')


mmodely documentation built on May 31, 2023, 6:47 p.m.