[R] Question about 'NA'

Jerome Asselin jerome at hivnet.ubc.ca
Thu Aug 7 22:22:46 CEST 2003


dat <- data.frame(x=c(1,NA,2,2),y=c(3,2,NA,1))
dat
dat[rownames(na.omit(dat[,"y",drop=F])),]

> dat <- data.frame(x=c(1,NA,2,2),y=c(3,2,NA,1))
> dat
   x  y
1  1  3
2 NA  2
3  2 NA
4  2  1
> dat[rownames(na.omit(dat[,"y",drop=F])),]
   x y
1  1 3
2 NA 2
4  2 1

HTH,
Jerome

On August 7, 2003 01:05 pm, Christian Mora wrote:
> Hi all,
>
> Ive got a database with 10 columns (different
> variables) for 100 subjects, each column with
> different # of NA's. I'd like to know if it is
> possible to use a function to exclude the NA's using
> only a specific column, lets say:
>
> Data2 <- omit.exclude(Data1$column1) ??, then
> Data3 <- omit.exclude(Data1$column2) and so on
>
> I tried the code above but with no results
>
> Thanks for any help
>
> CM
>
> __________________________________
>
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list