Learn R Programming

crawl (version 2.3.0)

fillCols: Fill missing values in data set (or matrix) columns for which there is a single unique value

Description

Looks for columns in a data set that have a single unique non-missing value and fills in all NA with that value

Usage

fillCols(data)

Value

data.frame

Arguments

data

data.frame

Author

Devin S. Johnson

Examples

Run this code

#library(crawl)
data1 <- data.frame(constVals=rep(c(1,NA),5), vals=1:10)
data1[5,2] <- NA
data1
data2 <- fillCols(data1)
data2

mat1 <- matrix(c(rep(c(1,NA),5), 1:10), ncol=2)
mat1[5,2] <- NA
mat1
mat2 <- fillCols(mat1)
mat2

Run the code above in your browser using DataLab