[R] svytable including NAs

tesutton tesutton at hku.hk
Thu Sep 15 01:30:33 CEST 2011


Thanks for the replies. I'll go with redefining the factor levels for now.
Thanks very much
Tim 
--

Tim Elwell-Sutton
The University of Hong Kong
Office:  3906 2053
Mob: 6084 5654
________________________________________
From: Thomas Lumley [tlumley at uw.edu]
Sent: Thursday, September 15, 2011 5:36 AM
To: David Winsemius
Cc: tesutton; r-help at r-project.org
Subject: Re: [R] svytable including NAs

On Thu, Sep 15, 2011 at 1:49 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Sep 14, 2011, at 6:12 AM, tesutton wrote:
>
>> Dear all
>>
>> I'm creating two way tables based on weighted survey data using svytable
>> and want to include NAs as a level in the table.
>> For unweighted data I use table(..., useNA="ifany"). Is there any
>> equivalent for svytable?
>>
>> If not, is there a solution using a different function?
>
> I don't know the answer to the first question, but my first experiment to
> solve would be to redefine your factors with:
>
>  fac <- factor(fac, exclude=NULL)
>   ... so that you get an <NA> level and label rather than having NAs.
>

That's the current solution.  I'll add an exclude= argument to
svytable() for the next version.

   -thomas


--
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list