Description Usage Arguments Details Value Examples
Insert, delete and replace steps in an (already declared) design object.
1 2 3 4 5 | insert_step(design, new_step, before, after)
delete_step(design, step)
replace_step(design, step, new_step)
|
design |
A design object, usually created using the + operator, |
new_step |
The new step; Either a function or a partial call. |
before |
The step before which to add steps. |
after |
The step after which to add steps. |
step |
The quoted label of the step to be deleted or replaced. |
See modify_design
for details.
A new design object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | my_population <- declare_population(N = 100, noise = rnorm(N), label = "my_pop")
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 <- my_population + my_potential_outcomes + my_assignment
design
insert_step(design, declare_step(dplyr::mutate, income = noise^2), after = my_assignment)
insert_step(design, declare_step(dplyr::mutate, income = noise^2), before = my_assignment)
# If you are using a design created by a designer, for example from
# the DesignLibrary package, you will not have access to the step
# objects. Instead, you can always use the label of the step.
# get the labels for the steps
names(design)
insert_step(design, declare_sampling(n = 50), after = "my_pop")
delete_step(design, my_assignment)
replace_step(design, my_assignment, declare_step(dplyr::mutate, words = "income"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.