missing.fill.in {mmodely} | R 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')
[Package mmodely version 0.2.5 Index]