Remove a step from an existing design

remove_step(...)

## Arguments

... bare (unquoted) names of step(s) to remove from a design

## Details

see modify_design for details.

## Examples


my_population <- declare_population(N = 100, noise = rnorm(N))

my_potential_outcomes <-
declare_potential_outcomes(Y_Z_0 = noise,
Y_Z_1 = noise + rnorm(N, mean = 2, sd = 2))

my_assignment <- declare_assignment(m = 50)
my_assignment_2 <- declare_assignment(m = 25)

design <- declare_design(my_population,
my_potential_outcomes,
my_assignment)

design#>
#> Design Summary
#>
#> Step 1 (population): my_population ---------------------------------------------
#>
#> N = 100
#>
#>  N_missing N_unique
#>          0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -2.67   0.07 0.14 2.67 0.99         0      100
#>
#> Step 2 (potential outcomes): my_potential_outcomes -----------------------------
#>
#>    min median mean  max   sd N_missing N_unique
#>  -2.67   0.07 0.14 2.67 0.99         0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -4.43   2.05 2.07 7.69 2.53         0      100
#>
#> Step 3 (assignment): my_assignment ---------------------------------------------
#>
#>                0    1
#>   Frequency   50   50
#>  Proportion 0.50 0.50
#>
#>              0.5
#>   Frequency  100
#>  Proportion 1.00
#>
modify_design(design, replace_step(my_assignment_2, replace = my_assignment))#>
#> Design Summary
#>
#> Step 1 (population): my_population ---------------------------------------------
#>
#> N = 100
#>
#>  N_missing N_unique
#>          0      100
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.44   0.05 -0.00 2.24 0.92         0      100
#>
#> Step 2 (potential outcomes): my_potential_outcomes -----------------------------
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.44   0.05 -0.00 2.24 0.92         0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -4.09   2.14 2.20 7.72 1.99         0      100
#>
#> Step 3 (assignment): my_assignment_2 -------------------------------------------
#>
#>                0    1
#>   Frequency   75   25
#>  Proportion 0.75 0.25
#>
#>             0.25 0.75
#>   Frequency   25   75
#>  Proportion 0.25 0.75
#>
modify_design(design, add_step(dplyr::mutate(income = noise^2), after = my_assignment))#>
#> Design Summary
#>
#> Step 1 (population): my_population ---------------------------------------------
#>
#> N = 100
#>
#>  N_missing N_unique
#>          0      100
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.18  -0.10 -0.12 2.19 0.97         0      100
#>
#> Step 2 (potential outcomes): my_potential_outcomes -----------------------------
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.18  -0.10 -0.12 2.19 0.97         0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -4.08   1.77 1.69 7.66 2.06         0      100
#>
#> Step 3 (assignment): my_assignment ---------------------------------------------
#>
#>                0    1
#>   Frequency   50   50
#>  Proportion 0.50 0.50
#>
#>              0.5
#>   Frequency  100
#>  Proportion 1.00
#>
#> Step 4 (declare step): dplyr::mutate(income = noise^2) -------------------------
#>
#>   min median mean  max   sd N_missing N_unique
#>  0.00   0.49 0.95 4.78 1.18         0      100
#>  modify_design(design, add_step(dplyr::mutate(income = noise^2), before = my_assignment))#>
#> Design Summary
#>
#> Step 1 (population): my_population ---------------------------------------------
#>
#> N = 100
#>
#>  N_missing N_unique
#>          0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -2.71   0.11 0.07 2.49 0.92         0      100
#>
#> Step 2 (potential outcomes): my_potential_outcomes -----------------------------
#>
#>    min median mean  max   sd N_missing N_unique
#>  -2.71   0.11 0.07 2.49 0.92         0      100
#>
#>    min median mean  max   sd N_missing N_unique
#>  -2.55   2.57 2.42 8.21 2.07         0      100
#>
#> Step 3 (declare step): dplyr::mutate(income = noise^2) -------------------------
#>
#>   min median mean  max   sd N_missing N_unique
#>  0.00   0.51 0.85 7.34 1.16         0      100
#>
#> Step 4 (assignment): my_assignment ---------------------------------------------
#>
#>                0    1
#>   Frequency   50   50
#>  Proportion 0.50 0.50
#>
#>              0.5
#>   Frequency  100
#>  Proportion 1.00
#>
modify_design(design, remove_step(my_assignment))#>
#> Design Summary
#>
#> Step 1 (population): my_population ---------------------------------------------
#>
#> N = 100
#>
#>  N_missing N_unique
#>          0      100
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.51  -0.20 -0.16 2.84 1.00         0      100
#>
#> Step 2 (potential outcomes): my_potential_outcomes -----------------------------
#>
#>    min median  mean  max   sd N_missing N_unique
#>  -2.51  -0.20 -0.16 2.84 1.00         0      100
#>
#>