This is just a very simple question but I just cant find the right function to use from the web and books.
this is an example I got from one of the post here.
df <- data.frame(sex = c('F', 'M', 'F', 'M', 'M', 'M', 'F', 'F'),
married = c(1,1,1,1,0,0,1,1),
pens = c(0, 1, 1, 1, 1, 1, 0, 0),
weight = c(1.12, 0.55, 1.1, 0.6, 0.23, 0.23, 0.66, 0.67))
d.s <- svydesign(ids=~1, data=df, weights=~weight)
I want to calculate the percentage variables such as married and calculate the standard error too?
also I want to do crosstab of married and pens and get the standard error of the resulting proportion?
how do i do that?
i tried svymean but it would treat the numeric values as integers instead of factors.
use svytable
summary(d.s)
svytable(~married+pens, d.s)
svytable(married~pens, d.s)
svytable(married~., d.s) #with all variable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With