Description Usage Arguments Value Author(s) Examples
This function takes a data.frame or matrix and looks for columns containing no data. This is judged by all elements in a column containing only NAs, NaNs or empty strings, which maybe user defined. Columns can be removed when containing a mixture of things judged to contain no data. Currently lists are not supported. haven library reads .sas7bdat files and returns them as lists. Such would need to be converted to data.frames.
1 | rmEmptyCol(d, na.strings = ".")
|
d |
a data.frame or matrix |
na.strings |
a character vector of strings that should be considered as NA. Regular expressions are not supported. Strings are matched exactly: "." is not the same as ". " |
A data.frame or matrix as was supplied, with any empty columns removed.
Aaron Hayman
1 2 | d = data.frame(a=1:100000,b=NA,c=runif(100000),d='.',e=sample(c('.',NA,'NA',NaN,''),100000,TRUE))
e = rmEmptyCol(d)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.