Hi Vickie,

You might try the following:

# some data
set.seed(123)
X <- matrix(rnorm(1000), ncol = 20)
X[sample(1000, 100)] <- NA

# excluding rows with NA >20%
X[!rowMeans(is.na(X)) > 0.2, ]

# excluding columns with NA >10%
X[, !colMeans(is.na(X)) > 0.1]

See ?is.na, ?rowMeans and ?colMeans for more information.

HTH,
Jorge

On Fri, May 13, 2011 at 9:42 AM, Vickie S <> wrote:

>
> Hi
> naive question.
> It is possible to get R command for omitting rows or cols with missing
> values present.
>
> But
> if i want to omit rows or cols with i.e . >20% missing values, I
> could“t find any package-based command, probably because it is too
> simple for anyone to do that manually, though not for me. Can anyone
> please help me ?
>
> - vickie
>
>
>
>
>
>
>
>
>
>
>
>
>        [[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.
>
>

        [[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