[R] Help with ftable.svyby

Orsola Costantini ursilla at libero.it
Sun Jul 9 22:58:34 CEST 2017


Thanks, Anthony! It worked!!
Only, for future reference, I had to exclude INCOME from the reset (which
is the variable in the svymean function)
q50 <- update( q50 , AGECL = factor( AGECL ) , RACECL = factor( RACECL ) )



2017-07-09 15:52 GMT-04:00 Anthony Damico <ajdamico at gmail.com>:

> 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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list