Skip to contents

Function to create new variables similar to Stata COMPUTE function for the same porpose

Usage

step_compute(
  svy = NULL,
  ...,
  .by = NULL,
  use_copy = use_copy_default(),
  comment = "Compute step",
  .level = "auto"
)

Arguments

svy

Survey object or RotativePanelSurvey

...

<data-masking> Name-value pairs. The name gives the name of the column in the output.

The value can be:

  • A vector of length 1, which will be recycled to the correct length.

  • A vector the same length as the current group (or the whole data frame if ungrouped).

  • NULL, to remove the column. A data frame or tibble, to create multiple columns in the output.

.by

Strig with group variable to compute

use_copy

Logical, if its FALSE adds the new variables to reference object like data.table, if it is TRUE adds the new variables to a new object

comment

String to add metadata information to the stap compute compatible with Markdown syntax

.level

String use for Rotative_Panel_survey object indicating data to use, level options available; 'implantation' or 'follow-up'

Value

Survey or Rotative_Panel_Survey object

Examples

if (FALSE) { # \dontrun{
step_compute(
pd=POBPCOAC %in% 3:5,
.default = 0,
comment = "Población Desocupada",
.level = "follow_up"
)
} # }