x[!is.na(x[, 3]), ]

HTH,
Dennis

On Fri, May 14, 2010 at 12:16 PM, Ryan Utz <utz.r...@gmail.com> wrote:

> Hi all,
>
> I'm relatively new to R and have a data management problem. I am importing
> a
> data matrix with some columns that have missing values. I am trying to
> figure out how to delete rows with NA for data FOR JUST ONE SPECIFIED
> column. For instance, with the example matrix:
>
> x<-matrix(nrow=5,ncol=3)
> x[,]<-1
> x[5,1]<-NA
> x[3,3]<-NA
>
> how do I tell R to delete any rows with an NA value in column 3, but NA in
> column 1 is just fine? I've played with na.omit but that just takes out all
> of the NA values...
>
> Thanks ahead of time for any help,
> Ryan Utz
>
>        [[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