Skip to content
Back to formatted view

Raw Message

Message-ID: <6585CBDB-0ACC-4CDC-BF1A-217FBF8AF9DB@comcast.net>
Date: 2012-07-05T17:34:46Z
From: David Winsemius
Subject: Exclude missing values on only 1 variable
In-Reply-To: <CACm_P7pqGWSiPfkdUc5pZhHz3Y=Bf34-U7Zz3CoLKB2R7zMaKw@mail.gmail.com>

On Jul 5, 2012, at 1:25 PM, Eiko Fried wrote:

> Hello,
>
> I have many hundred variables in my longitudinal dataset and lots of
> missings. In order to plot data I need to remove missings.
>
> If I do
>> data <- na.omit(data)
> that will reduce my dataset to 2% of its original size ;)
>
> So I only need to listwise delete missings on 3 variables (the ones  
> I am
> plotting).
>
> data$variable1 <-na.omit(data$variable1)

?complete.cases  # returns a logical vector

data[ complete.cases( data[ , c("var1", "var2", "var3"]) , ]


David Winsemius, MD
West Hartford, CT