survey (version 3.9-1)

update.survey.design: Add variables to a survey design

Description

Update the data variables in a survey design, either with a formula for a new set of variables or with an expression for variables to be added.

Usage

## S3 method for class 'survey.design':
update(object, ...)
## S3 method for class 'twophase':
update(object, ...)
## S3 method for class 'svyrep.design':
update(object, ...)

Arguments

object
a survey design object
...
Arguments tag=expr add a new variable tag computed by evaluating expr in the survey data.

Value

  • A survey design object

See Also

svydesign, svrepdesign, twophase

Examples

Run this code
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat,
fpc=~fpc)
dstrat<-update(dstrat, apidiff=api00-api99)
svymean(~api99+api00+apidiff, dstrat)

Run the code above in your browser using DataLab