Randomize cases into experimental conditions
randomizer( dataset, vars, conditions = c("A", "B"), blocks = NULL, probs = NULL, label = ".conditions", seed = 1234, data_filter = "", na.rm = FALSE, envir = parent.frame() )
dataset | Dataset to sample from |
---|---|
vars | The variables to sample |
conditions | Conditions to assign to |
blocks | A vector to use for blocking or a data.frame from which to construct a blocking vector |
probs | A vector of assignment probabilities for each treatment conditions. By default each condition is assigned with equal probability |
label | Name to use for the generated condition variable |
seed | Random seed to use as the starting point |
data_filter | Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000") |
na.rm | Remove rows with missing values (FALSE or TRUE) |
envir | Environment to extract data from |
A list of variables defined in randomizer as an object of class randomizer
Wrapper for the complete_ra and block_ra from the randomizr package. See https://radiant-rstats.github.io/docs/design/randomizer.html for an example in Radiant
summary.sampling
to summarize results
#> List of 10 #> $ df_name : chr "rndnames" #> $ dataset :'data.frame': 100 obs. of 2 variables: #> ..$ .conditions: Factor w/ 2 levels "test","control": 1 2 1 1 1 1 1 1 2 2 ... #> ..$ Names : chr [1:100] "Ervin Escalona" "Allan Ammerman" "Milton Mothershed" "Deshawn Dawn" ... #> $ vars : chr "Names" #> $ conditions : chr [1:2] "test" "control" #> $ blocks : NULL #> $ probs : num [1:2] 0.5 0.5 #> $ label : chr ".conditions" #> $ seed : chr "1234" #> $ data_filter: chr "" #> $ na.rm : logi FALSE #> - attr(*, "class")= chr [1:2] "randomizer" "list"