Hi Faz,

Here is one way of doing it where "x" is your data frame:

x[, colMeans(is.na(x)) <= .15]

HTH,
Jorge.-


On Sun, Aug 5, 2012 at 9:04 PM, Faz Jones <> wrote:

> I have a dataframe of 10 different columns (length of each column is
> the same). I want to eliminate any column that has 'NA' greater than
> 15% of the column length. Do i first need to make a function for
> calculating the percentage of NA for each column and then make another
> dataframe where i apply the function? Whats the best way to do this.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to