write.svystat: Export Survey Statistics

write.svystatR Documentation

Export Survey Statistics

Description

Prints survey statistics to a file or connection.

Usage

write.svystat(x, ...)

Arguments

x

An object containing survey statistics.

...

Arguments to write.table

Details

This function is just a convenience wrapper to write.table, designed to export objects which have been returned by survey statistics functions (e.g. svystatTM, svystatR, svystatS, svystatSR, svystatB, svystatQ, svystatL, svySigma, svySigma2).

Author(s)

Diego Zardetto

See Also

write.table and the 'R Data Import/Export' manual.

Examples

# Creation of a design object:
data(sbs)
des<-e.svydesign(data=sbs,ids=~id,strata=~strata,weights=~weight,
     fpc=~fpc)

# Estimation of the average value added per employee
# for economic activity region and macro-sectors,
# with SE, CV% and standard confidence intervals:
stat <- svystatR(des,~va.imp2,~emp.num,by=~region:nace.macro,
        vartype=c("se","cvpct"),conf.int=TRUE)
stat

# In order to export the summary statistics above
# into a CSV file for input to Excel one can use:
## Not run: 
write.svystat(stat,file="stat.csv",sep=";")

## End(Not run)

# ...and to read this file back into R one needs
## Not run: 
stat.back <- read.table("stat.csv",header=TRUE,sep=";",
             check.names=FALSE)
stat.back

## End(Not run)

# Notice, however, that the latter object has
# lost a lot of meta-data as compared to the
# original one, so that e.g.:
## Not run: 
confint(stat.back)

## End(Not run)

# ...while, on the contrary:
confint(stat)

DiegoZardetto/ReGenesees documentation built on Dec. 16, 2024, 2:03 p.m.