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
nameThe name of the step.
editionThe edition of the survey associated with the step.
survey_typeThe type of survey associated with the step.
typeThe type of operation performed by the step (e.g., "compute", "recode").
new_varThe name of the new variable created by the step, if applicable.
exprsA list of expressions defining the step's operations.
callThe function call associated with the step.
svy_beforeThe survey object before the step is applied.
default_engineThe default engine used for processing the step.
depends_onA list of variables that the step depends on.
commentsComments or notes about the step.
bakeA logical value indicating whether the step has been executed.
expressionsOptional list of AST expressions used by this step (for AST-backed steps).
namesOptional character vector with the variable names associated to
expressions.ast_infoOptional list with AST metadata (original expressions, optimized versions, dependencies, flags).
Methods
Method new()
Create a new Step object
Usage
Step$new(
name,
edition,
survey_type,
type,
new_var,
exprs,
call,
svy_before,
default_engine,
depends_on,
comments = NULL,
bake = !lazy_default(),
comment = NULL,
expressions = NULL,
names = NULL,
ast_info = NULL
)Arguments
nameThe name of the step.
editionThe edition of the survey associated with the step.
survey_typeThe type of survey associated with the step.
typeThe type of operation performed by the step (e.g., "compute" or "recode").
new_varThe name of the new variable created by the step, if applicable.
exprsA list of expressions defining the step's operations.
callThe function call associated with the step.
svy_beforeThe survey object before the step is applied.
default_engineThe default engine used for processing the step.
depends_onA list of variables that the step depends on.
commentsComments or notes about the step.
bakeA logical value indicating whether the step has been executed.
commentOptional alias of
commentsfor backwards compatibility.expressionsOptional list of AST expressions for AST compute steps.
namesOptional character vector of variable names for AST compute steps.
ast_infoOptional list with AST-related metadata for this step.
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:
#> ast_info: NULL
#> bake: FALSE
#> call: NULL
#> clone: function (deep = FALSE)
#> comments: Example step
#> default_engine: NULL
#> depends_on: list
#> edition: 2023
#> expressions: NULL
#> exprs: list
#> initialize: function (name, edition, survey_type, type, new_var, exprs, call,
#> name: example_step
#> names: NULL
#> new_var: example_var
#> survey_type: example_survey
#> svy_before: NULL
#> type: compute
