Skip to content
Prev 310396 / 398506 Next

Remove missings (quick question)

On Nov 9, 2012, at 10:50 AM, Eiko Fried <torvon at gmail.com> wrote:

            
Modify the initial read.csv() call to:

  D <- read.csv("x.csv", na.strings = "-999")

That will convert all -999 values to NA's upon import so that you don't have to post-process it.

See ?read.csv for more info.

Once that is done, R's default behavior is to remove observations with any missing data (eg. NA values) when using modeling functions. Or you can pre-process using:

  D.New <- na.omit(D)

and then use D.New for all of your subsequent analyses. See ?na.omit.

Regards,

Marc Schwartz