Learn R Programming

survey (version 3.32-1)

ftable.svystat: Lay out tables of survey statistics

Description

Reformat the output of survey computations to a table.

Usage

# S3 method for svystat
ftable(x, rownames,...)
# S3 method for svrepstat
ftable(x, rownames,...)
# S3 method for svyby
ftable(x,...)

Arguments

x

Output of functions such as svymean,svrepmean, svyby

rownames

List of vectors of strings giving dimension names for the resulting table (see examples)

...

Arguments for future expansion

Value

An object of class "ftable"

See Also

ftable

Examples

Run this code
# NOT RUN {
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

a<-svymean(~interaction(stype,comp.imp), design=dclus1)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
b

a<-svymean(~interaction(stype,comp.imp), design=dclus1, deff=TRUE)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
round(100*b,1)

rclus1<-as.svrepdesign(dclus1)
a<-svytotal(~interaction(stype,comp.imp), design=rclus1)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
b
round(b)

a<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE)
ftable(a)
print(ftable(a),digits=2)

b<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE, deff=TRUE)
print(ftable(b),digits=2)

d<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE, vartype=c("se","cvpct"))
round(ftable(d),1)

# }

Run the code above in your browser using DataLab