modify_design: Modify a design after the fact

Description Usage Arguments Details Value Examples

Description

Insert, delete and replace steps in an (already declared) design object.

Usage

1
2
3
4
5
insert_step(design, new_step, before = NULL, after = NULL)

delete_step(design, step)

replace_step(design, step, new_step)

Arguments

design

a design object, usually created by declare_design, expand_design, or the design library.

new_step

the new step - either a function or a partial call

before

the step before which to add steps

after

same

step

the step to be deleted or replaced

Details

see modify_design for details.

Value

A new design object. See declare_design for details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 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


 insert_step(design, dplyr::mutate(income = noise^2), after = my_assignment)
 insert_step(design, dplyr::mutate(income = noise^2), before = my_assignment)


 delete_step(design, my_assignment)
 replace_step(design, my_assignment, dplyr::mutate(words="HIARYLAH"))

graemeblair/DeclareDesign documentation built on May 8, 2018, 1:24 p.m.