Hello I'm trying to get the proportion "true" for dichotomous variable for various subgroups in a survey.
This works fine, but obviously doesn't give proportions directly: svytable(~SurvYear+problem.vandal, seh.dsn, round=TRUE) problem.vandal SurvYear FALSE TRUE 1995 8906 786 1997 17164 2494 1998 17890 1921 1999 18322 1669 2001 17623 2122 ... Note some years are missing - they are part of the dataset, but all responses are NA (the question wasn't asked). However, this gives an error, and I'd like to understand why - it works for variables without missing years: svyby(~problem.vandal, ~SurvYear, seh.dsn, svymean, na.rm=TRUE) Error in tapply(1:NROW(x), list(factor(strata)), function(index) { : arguments must have same length The error only occurs when na.rm=TRUE and there are no observations in one year. Thanks alex Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer ______________________________________________ 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.