[R] Help with ftable.svyby
Anthony Damico
ajdamico at gmail.com
Sun Jul 9 21:52:09 CEST 2017
try resetting your factor levels and re-run?
q50 <- update( q50 , INCOME = factor( INCOME ) , AGECL = factor( AGECL ) ,
RACECL = factor( RACECL ) )
On Sun, Jul 9, 2017 at 2:59 PM, Orsola Costantini via R-help <
r-help at r-project.org> wrote:
> Hi all,
>
> When I try the following with pkg Survey it returns the error below:
>
> ftable(svyby(~INCOME, ~AGECL+RACECL, svymean, design=q50),
> rownames=list(AGECL=c("<35", "35-44", "45-54", "55-64",
> "65-74", ">=75"),
> RACECL=c("white non hispanic", "non white or hispanic"))
>
> Error in rbind(matrix("", nrow = length(xcv), ncol = length(xrv)),
> charQuote(makeNames(xrv)), :
> number of columns of matrices must match (see arg 3)
>
> When I do the follwing instead all is good. But it only works for small
> subsets!
>
> h<-svymean(~interaction(INCOME, AGECL, RACECL), q3)
>
> fh<-ftable(h, rownames=list(AGECL=c("<35", "35-44", "45-54", "55-64",
> "65-74", ">=75"),
> RACECL=c("white non his", "non white or hispanic")))
>
>
> any idea why?
>
> Thanks!!!
>
> U.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list