Learn R Programming

healthcareai (version 1.2.4)

removeColsWithAllSameValue: Remove columns from a data frame when those columns have the same values in each row

Description

Remove columns from a data frame when all of their rows are the same value (after removing NA's)

Usage

removeColsWithAllSameValue(df)

Arguments

df

A data frame

Value

A data frame with zero-variance columns removed

References

http://healthcareai-r.readthedocs.io

See Also

healthcareai

Examples

Run this code
# NOT RUN {
df <- data.frame(a=c(1,1,1),
                b=c('a','b','b'),
                c=c('a','a','a'),
                d=c(NA,'1',NA))
dfResult <- removeColsWithAllSameValue(df)
head(dfResult)
# }

Run the code above in your browser using DataLab