An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110415/cf6d5f87/attachment.pl>
Function for deleting variables with >=50% missing obs from a data frame
2 messages · Rita Carreira, Ben Bolker
Rita Carreira <ritacarreira <at> hotmail.com> writes:
I have several data frames where some of the variables have many missing observations. For example, Q1 in one of my data frames has over 66% of its observations missing. I have tried imputation with mice but it does not work for all the data frames and I get the following message or a similar message to this:
How about
missing_prop <- sapply(orig_data,function(x) { mean(is.na(x)) })
good_data <- orig_data[missing_prop>0.5]
(untested)