update.sqlsurvey: Add variables to survey objects

Description Usage Arguments Value Note See Also Examples

Description

UNDER DEVELOPMENT. Adds variables to a sqlsurvey object. Works by defining a MonetDB function to evaluate the new variable as needed. At the moment, variables created in one update call cannot be used in another update call. This should change eventually.

Usage

1
2
3
4
## S3 method for class 'sqlsurvey'
update(object, ...)
## S3 method for class 'sqlrepsurvey'
update(object, ...)

Arguments

object

sqlsurvey object

...

variables to add, in name=expr format.

Value

New sqlsurvey object with added variables.

Note

Functions and operators must exist in MonetDB SQL. The logical operators and %in% are translated to their SQL counterparts.

Especially for the sqlsurvey objects there are some problems with boolean variables, so it's currently better to add zero to a boolean to make it numeric 0/1.

See Also

sqlsurvey

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
## add variables for pulse pressure and hypertension to an NHANES
example object
sqhanes1 <- update(sqhanes, pulsep = bpxsar-bpxdar, htn = 0+(bpxsar>140 | bpxsar>90))

svymean(~bpxsar+bpxdar+pulsep, sqhanes, se=TRUE)
svymean(~bpxsar+bpxdar, subset(sqhanes, htn==1), se=TRUE)


## End(Not run)

sqlsurvey documentation built on May 2, 2019, 4:53 p.m.