That still discards the other data columns.  For example, in the data frame

V1 V2 V3 V4
1  1  1  NA 1
2  1 NA  1  1
3  1 NA  1  1
4  1  1    1  1
5  1  1    1  1

Suppose I was running a regression using V1 and V2.  R will remove rows 2
and 3 due to the "NA."  I would like a way to look at only the observations
used for the regression, the data frame:

V1 V2 V3 V4
1  1  1  NA 1
4  1  1    1  1
5  1  1    1  1

If I run na.omit(subset(dataframe, select= c(V1,V2)) it returns

V1 V2
1  1  1
4  1  1
5  1  1

Sorry for being unclear the previous time.

Justin

On Tue, Sep 20, 2011 at 4:54 AM, David Winsemius <dwinsemius@comcast.net>wrote:

>
> On Sep 19, 2011, at 8:49 PM, justin jarvis wrote:
>
>  I have a data set with many missing observations.  When I run a
>> regression, R of course discards the observations (the whole row) that
>> have "NA".  I want to tabulate some baseline characteristics (column
>> means) but only for the observations that R used for the regression.
>> I tried to recreate this data frame by using na.omit on the original
>> data frame, but this will not work as this will discard an observation
>> with an "NA" in any column, and not just in the covariates.
>>
>> In summary, I only want to remove observations that have an "NA" in
>> the covariate columns.  Something like Stata's e(sample), as far as I
>>
>
> na.omit(subset(dfrm, select= <covariate-vector> )  # or equivalent
>
>  can tell.
>>
>> Justin Jarvis
>> PhD student, University of California, Irvine
>>
>> ______________________________**________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> David Winsemius, MD
> West Hartford, CT
>
>

	[[alternative HTML version deleted]]

