The Step
class is used to define and manage individual steps in a survey workflow. Each step can include operations such as recoding variables, computing new variables, or validating dependencies.
Details
The Step
class is part of the survey workflow system and is designed to encapsulate all the information and operations required for a single step in the workflow. Steps can be chained together to form a complete workflow.
Public fields
name
The name of the step.
edition
The edition of the survey associated with the step.
survey_type
The type of survey associated with the step.
type
The type of operation performed by the step (e.g., "compute", "recode").
new_var
The name of the new variable created by the step, if applicable.
exprs
A list of expressions defining the step's operations.
call
The function call associated with the step.
svy_before
The survey object before the step is applied.
default_engine
The default engine used for processing the step.
depends_on
A list of variables that the step depends on.
comments
Comments or notes about the step.
bake
A logical value indicating whether the step has been executed.
Methods
Method new()
Initializes a new Step object with the provided attributes.
Usage
Step$new(
name,
edition,
survey_type,
type,
new_var,
exprs,
call,
svy_before,
default_engine,
depends_on,
comments,
bake = !lazy_default()
)
Arguments
name
The name of the step.
edition
The edition of the survey associated with the step.
survey_type
The type of survey associated with the step.
type
The type of operation performed by the step (e.g., "compute", "recode").
new_var
The name of the new variable created by the step, if applicable.
exprs
A list of expressions defining the step's operations.
call
The function call associated with the step.
svy_before
The survey object before the step is applied.
default_engine
The default engine used for processing the step.
depends_on
A list of variables that the step depends on.
comments
Comments or notes about the step.
bake
A logical value indicating whether the step has been executed.
Examples
step <- Step$new(
name = "example_step",
edition = "2023",
survey_type = "example_survey",
type = "compute",
new_var = "example_var",
exprs = list(a = 1, b = 2),
call = NULL,
svy_before = NULL,
default_engine = NULL,
depends_on = list("var1", "var2"),
comments = "Example step",
bake = FALSE
)
print(step)
#> <Step>
#> Public:
#> bake: FALSE
#> call: NULL
#> clone: function (deep = FALSE)
#> comments: Example step
#> default_engine: NULL
#> depends_on: list
#> edition: 2023
#> exprs: list
#> initialize: function (name, edition, survey_type, type, new_var, exprs, call,
#> name: example_step
#> new_var: example_var
#> survey_type: example_survey
#> svy_before: NULL
#> type: compute