Scrambles the elements of the vector and swaps a predefined number of elements. Afterwards, the vector is ordered according to the original ordering and returned.
swap_treatment(current_treatment, change, prev_index_list = NULL)
a treatment vector to be changed.
number of elements that will be changed in the treatment vector.
not used, needed for compatibility.
Returns a new treatment vector.
# NOT RUN { swap_treatment(current_treatment = c(0, 2, 0, 1, 1, 0, 2, 1, 1, 0), change = 2) # }
Run the code above in your browser using DataLab