Skip to contents

Create a new variable which is true if all of the variables in a list of variables are true.

Usage

var_all(newvr, vrs)

Arguments

newvr

name of the new variable to be created

vrs

vector of logical variables

Value

Survey object

See also

Other variables: var_any(), var_case(), var_collapse(), var_copy(), var_cross(), var_cut(), var_not()

Examples

set_survey(namcs2019sv)
#>                         Survey info {NAMCS 2019 PUF}                         
#> ┌───────────┬──────────────┬────────────────────────────────────────────────┐
#> │ Variables │ Observations │ Design                                         │
#> ├───────────┼──────────────┼────────────────────────────────────────────────┤
#> │        33 │        8,250 │ Stratified 1 - level Cluster Sampling design   │
#> │           │              │ (with replacement)                             │
#> │           │              │ With (398) clusters.                           │
#> │           │              │ namcs2019sv = survey::svydesign(ids = ~CPSUM,  │
#> │           │              │ strata = ~CSTRATM, weights = ~PATWT            │
#> │           │              │ , data = namcs2019sv_df)                       │
#> └───────────┴──────────────┴────────────────────────────────────────────────┘
#> 
var_all("Medicare and Medicaid", c("PAYMCARE", "PAYMCAID"))
tab("Medicare and Medicaid")
#>                      Medicare and Medicaid (knowns only) {NAMCS 2019 PUF}                      
#> ┌───────┬───────┬─────────────┬──────────┬──────────┬───────────┬─────────┬─────┬──────┬──────┐
#> │ Level │     n │      Number │ SE (000) │ LL (000) │  UL (000) │ Percent │  SE │   LL │   UL │
#> │       │       │       (000) │          │          │           │         │     │      │      │
#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤
#> │ FALSE │ 8,126 │   1,016,202 │   47,395 │  927,389 │ 1,113,520 │      98 │ 0.5 │ 96.9 │ 98.9 │
#> ├───────┼───────┼─────────────┼──────────┼──────────┼───────────┼─────────┼─────┼──────┼──────┤
#> │ TRUE  │   124 │      20,282 │    5,177 │   12,120 │    33,941 │       2 │ 0.5 │  1.1 │  3.1 │
#> └───────┴───────┴─────────────┴──────────┴──────────┴───────────┴─────────┴─────┴──────┴──────┘
#>   N = 8250. Checked NCHS presentation standards. Nothing to                                    
#>   report.                                                                                      
#>