On Fri, May 20, 2011 at 7:54 PM, Manderscheid Katharina
<katharina.mandersch...@unilu.ch> wrote:
> hi thomas
>
> thanks for your reply.
> in the documentation of svytable, the argument na.rm=T is mentioned.

No, it isn't.  The page says

Usage

## S3 method for class 'survey.design':
svytable(formula, design, Ntotal = NULL, round = FALSE,...)
## S3 method for class 'svyrep.design':
svytable(formula, design, Ntotal = sum(weights(design, "sampling")),
round = FALSE,...)

There *is* an na.rm= argument to svychisq(), which is documented on
the same help page.

>
> however, last night i figured out what went wrong in my tabulation: i had a 
> dataset which i attached and then defined the missing values - of course they 
> were not stored in the data set.
>
> attach(data)
> vote[vote=="Don't know"|vote=="Refusal"]<-NA
> detach(data)
>

Yes, that's why attach() is usually a bad idea -- it's very easy to
get confused that way.

> or is there a way to define factor levels as na directly in an 
> svydesign-object?
>
>

You can use update()

design <- update(design, vote=ifelse( vote %in% c("Don't
Know","Refusal"), NA, vote))


    -thomas


-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to