var_case {surveytable} | R Documentation |
Convert factor to logical
Description
Convert factor to logical
Usage
var_case(newvr, vr, cases, retain_na = TRUE)
Arguments
newvr |
name of the new logical variable to be created |
vr |
factor variable |
cases |
one or more levels of |
retain_na |
for the observations where |
Value
Survey object
See Also
Other variables:
var_all()
,
var_any()
,
var_collapse()
,
var_copy()
,
var_cross()
,
var_cut()
,
var_not()
Examples
set_survey(namcs2019sv)
var_case("Preventive care visits", "MAJOR", "Preventive care")
tab("Preventive care visits")
var_case("Surgery-related visits"
, "MAJOR"
, c("Pre-surgery", "Post-surgery"))
tab("Surgery-related visits")
var_case("Non-primary"
, "SPECCAT.bad"
, c("Surgical care specialty", "Medical care specialty"))
tab("Non-primary")
tab("Non-primary", drop_na = TRUE)
[Package surveytable version 0.9.4 Index]