Skip to content

Commit

Permalink
unique values to condition names
Browse files Browse the repository at this point in the history
  • Loading branch information
acoppock committed May 2, 2017
1 parent 076cdc4 commit 40ce25d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ check_randomizr_arguments <-
# Lengths

if (!is.null(condition_names)) {

if(length(unique(condition_names)) != length(condition_names)){
stop("You must supply unique values to condition_names.")
}
if (!is.null(m)) {
if (length(condition_names) != 2) {
stop(
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-condition-names.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ test_that("Condition Names", {
complete_ra(N = N, m = 3, condition_names = c(F, T))


expect_error(complete_ra(100, condition_names = c("control", "control", "treatment")))

})

0 comments on commit 40ce25d

Please sign in to comment.