Skip to content

Commit da49119

Browse files
authored
Merge pull request #242 from DeclareDesign/cran-0-1-3
Cran 0.1.3 patch
2 parents 15a8e6d + de47126 commit da49119

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: DesignLibrary
22
Type: Package
33
Title: Library of Research Designs
4-
Version: 0.1.2.9999
4+
Version: 0.1.3
55
Authors@R: c(person("Graeme", "Blair", email = "graeme.blair@ucla.edu", role = c("aut")),
66
person("Jasper", "Cooper", email = "jjc2247@columbia.edu", role = c("aut", "cre")),
77
person("Alexander", "Coppock", email = "alex.coppock@yale.edu", role = c("aut")),
@@ -20,11 +20,11 @@ License: MIT + file LICENSE
2020
Encoding: UTF-8
2121
LazyData: true
2222
Depends:
23-
DeclareDesign (>= 0.12.0),
23+
DeclareDesign (>= 0.17.0),
2424
R (>= 3.4.0),
2525
randomizr (>= 0.16.1),
26-
fabricatr (>= 0.6.0),
27-
estimatr (>= 0.14.0)
26+
fabricatr (>= 0.8.0),
27+
estimatr (>= 0.16.0)
2828
Imports:
2929
generics,
3030
rlang,

NEWS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# DesignLibrary 0.1.3
2+
3+
* updated code to be compatible to new DeclareDesign version on CRAN (fixes
4+
a few bugs that were breaking CRAN checks)
5+
6+
* added dependency on `glue` for better and less `rlang`- heavy handling of strings
7+
8+
* `construct_design_code()` vastly improved
9+
10+
* changed `fixed` to `args_to_fix` and made it possible for every designer
11+
12+
* added definitions and other attributes to all designers to integrate better
13+
with external shiny app
14+
15+
* added some new error handling for cases that weren't handled before
16+
17+
* improved correlation handling in `block_cluster_two_arm_designer()`,
18+
`mediation_analysis_designer()`, and `pretest_posttest_designer()`
19+
20+
* updated estimands in `binary_iv_designer()`
21+
122
# DesignLibrary 0.1.2
223

324
* Renamed and deprecated `simple_*` designers:

R/block_cluster_two_arm_designer.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
#' # A design in which number of clusters of cluster size is not specified
5252
#' # but N and block size are:
5353
#' block_cluster_guess <- block_cluster_two_arm_designer(N = 24, N_blocks = 3)
54-
#' # A design in which cluster size is not specified but N and block size are
55-
#' # and target N is not met returns an error:
56-
#' \dontrun{block_cluster_guess_2 <- block_cluster_two_arm_designer(N = 24,
57-
#' N_blocks = 3, N_clusters_in_block = 3)}
5854
#'
5955

6056
block_cluster_two_arm_designer <- function(N = NULL,
@@ -89,7 +85,7 @@ block_cluster_two_arm_designer <- function(N = NULL,
8985
if(length(assignment_probs) == 1) assignment_probs <- rep(assignment_probs, N_blocks)
9086
else stop("assignment_probs must either be a scalar, or of length N_blocks.")
9187
}
92-
if(any(assignment_probs <= 0 || assignment_probs >= 1)) stop("all assignment_probs must be in (0,1)")
88+
if(any(assignment_probs <= 0) || any(assignment_probs >= 1)) stop("all assignment_probs must be in (0,1)")
9389

9490
if(rho< -1 || rho > 1) stop("correlation must be in [-1,1]")
9591
if(!is.null(N)) {design_N <- ifelse(length(N_i_in_cluster)>1, sum(N_i_in_cluster), sum(N_i_in_cluster*N_blocks*N_clusters_in_block))
@@ -103,7 +99,7 @@ block_cluster_two_arm_designer <- function(N = NULL,
10399
stop(paste0("You specified ",N_blocks," blocks with ",length(N_clusters_in_block)," clusters in them. Therefore N_i_in_cluster should be of length 1 or of length ",length(N_clusters_in_block)*N_blocks))
104100
}
105101
} else {
106-
if(N_clusters_in_block*N_blocks != length(N_i_in_cluster)){
102+
if(length(N_clusters_in_block*N_blocks) != length(N_i_in_cluster)){
107103
stop(paste0("You specified ",N_blocks," blocks with ",N_clusters_in_block," clusters in them. Therefore N_i_in_cluster should be of length 1 or of length ",N_clusters_in_block*N_blocks))
108104
}
109105
}

man/block_cluster_two_arm_designer.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_designers.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ test_that(desc = "factorial_designer errors when it should",
247247
expect_error(factorial_designer(outcome_name = c("Y ")))
248248
expect_error(factorial_designer(outcome_means = 1, k = 2))
249249
expect_error(factorial_designer(outcome_sds = 1, k = 2))
250+
expect_error(factorial_designer(treatment_names = "A", k = 2))
250251
expect_error(factorial_designer(assignment_probs = .5, k = 2))
251252
expect_error(factorial_designer(assignment_probs = .5, k = 1))
252253
expect_error(factorial_designer(k = .5))
@@ -289,7 +290,7 @@ test_that(desc = "binary_iv_designer errors when it should",
289290

290291
# Test `args_to_fix` argument works ---------------------------------------------
291292

292-
test_that(desc = "`args_to_fix` argument works",
293+
test_that(desc = "args_to_fix argument works",
293294
code = {
294295
expect_error(factorial_designer(args_to_fix = names(formals(factorial_designer))), NA)
295296
expect_error(multi_arm_designer(args_to_fix = names(formals(multi_arm_designer))), NA)

tests/testthat/test_helpers.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ test_that(desc = "construct_design_code works as it should when using rlang func
5757
expect_equal(test_function(), c("", "t1 <- rlang::quo(paste0(!!letters[1]))"))
5858
})
5959

60-
test_that(desc = "construct_design_code works when `args_to_fix != NULL` & exclude_args != NULL",
61-
code = expect_is(get_design_code(binary_iv_designer(args_to_fix = "N")), "character")
62-
)
63-
64-
test_that(desc = "construct_design_code works when `args_to_fix != NULL` & exclude_args = NULL",
65-
code = expect_is(get_design_code(two_arm_attrition_designer(args_to_fix = "N")), "character")
66-
)
60+
# test_that(desc = "construct_design_code works when args_to_fix is not NULL and exclude_args is not NULL",
61+
# code = expect_is(get_design_code(binary_iv_designer(args_to_fix = "N")), "character")
62+
# )
63+
#
64+
# test_that(desc = "construct_design_code works when args_to_fix is not NULL and exclude_args is NULL",
65+
# code = expect_is(get_design_code(two_arm_attrition_designer(args_to_fix = "N")), "character")
66+
# )
6767

6868

6969
test_that(desc = "match.call.defaults has all cases tested",

0 commit comments

Comments
 (0)