[R] how to handle missing values

Achim Zeileis zeileis at ci.tuwien.ac.at
Wed Jul 16 12:19:31 CEST 2003


On Wednesday 16 July 2003 12:11, Tor A  Strand wrote:

> This group impresses me, so far I have been helped with all my
> questions within 24 hours. Thanks.
>
> Therefore another one.
>
> I am used to programs (such as STATA) where observations with
> missing values that are included in a model are simply ignored in
> the analysis. So far I have not been able to figure out how to deal
> with missing values in R and have solved the problem by deleting
> observations with missing values before loading them into R.
>
> Can anyone give me a hint on how to do this in a simpler way?

R can deal with NAs in several ways, look at
  help(na.omit)

Many methods, e.g., lm(), also take an na.action argument so that you 
can keep your data frame with the NAs in R, but fit linear models only 
on the complete cases for example.

Best,
Z


> Sincerely,
>
>
> Dr. Tor A Strand
> Centre for International Health
> Haukeland Hospital
> University of Bergen
> 5021 Bergen
> Norway
> Phone: (country prefix 47)
> Residence:56 51 10 88, office: 55 97 49 80,
> fax: 55 97 49 79, cellular:  90 97 10 86
>
> ______________________________________________
> 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