Skip to content

Commit

Permalink
prepare for tibble 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KZARCA committed Mar 6, 2020
1 parent 7adeb94 commit 4a32145
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export(status_cluster)
export(use_cluster)
export(use_distribution)
importFrom(dplyr,"%>%")
importFrom(dplyr,anti_join)
importFrom(dplyr,as.tbl)
importFrom(dplyr,as_data_frame)
importFrom(dplyr,bind_rows)
Expand Down
2 changes: 1 addition & 1 deletion R/heemod.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @importFrom dplyr ungroup
#' @importFrom dplyr mutate_if
#' @importFrom dplyr funs
#' @importFrom dplyr antijoin
#' @importFrom dplyr anti_join
#'
#' @importFrom plyr ldply
#' @importFrom plyr ddply
Expand Down
4 changes: 2 additions & 2 deletions R/part_surv.R
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ make_part_surv_from_small_tibble <- function(st, state_names){
stopifnot(length(pfs_row) == 1,
length(os_row) == 1
)
define_part_surv(pfs = st[[pfs_row, "fit"]],
os = st[[os_row, "fit"]],
define_part_surv(pfs = st[["fit"]][[pfs_row]],
os = st[["fit"]][[os_row]],
state_names = state_names)
}

Expand Down
5 changes: 3 additions & 2 deletions R/sensitivity_define.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ define_dsa_ <- function(par_names, low_dots, high_dots) {
all(par_names == names(low_dots)),
all(par_names == names(high_dots))
)
dots <- interleave(low_dots, high_dots)

dots <- interleave(low_dots, high_dots)
class(dots) <- c("list")
if (any(duplicated(par_names))) {
stop("Some names are duplicated.")
}
Expand All @@ -73,6 +73,7 @@ define_dsa_ <- function(par_names, low_dots, high_dots) {
})
}


clean_null <- function(x) {
Map(
function(el) if (is.null(el)) NA else el,
Expand Down
2 changes: 1 addition & 1 deletion man/look_up.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ test_that(
a = 2,
b = a * markov_cycle
)
e_par1 <- heemod:::eval_parameters(
e_par1 <- eval_parameters(
par1, 10
)
expect_output(
str(e_par1),
"10 obs\\. of 5 variables"
"\\[10 × 5\\]"
)
expect_equal(
get_parameter_names(e_par1),
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test_part_surv.R
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ test_that("we can run construct_part_surv_tib",
)
for_A <- dplyr::filter(explicit_dist_part_surv, .strategy == "A")
for_B <- dplyr::filter(explicit_dist_part_surv, .strategy == "B")
expect_equal(round(compute_surv(for_A[[1, "part_surv"]]$pfs, 1), 4), 0.0332)
expect_equal(round(compute_surv(for_A[[1, "part_surv"]]$os, 1), 4), 0.0150)
expect_equal(round(compute_surv(for_B[[1, "part_surv"]]$pfs, 1), 4), 0.0472)
expect_equal(round(compute_surv(for_B[[1, "part_surv"]]$os, 1), 4), 0.0213)
expect_equal(round(compute_surv(for_A[["part_surv"]][[1]]$pfs, 1), 4), 0.0332)
expect_equal(round(compute_surv(for_A[["part_surv"]][[1]]$os, 1), 4), 0.0150)
expect_equal(round(compute_surv(for_B[["part_surv"]][[1]]$pfs, 1), 4), 0.0472)
expect_equal(round(compute_surv(for_B[["part_surv"]][[1]]$os, 1), 4), 0.0213)

use_fits <- read_file(system.file("tabular/surv",
"use_fits_mixed.csv",
Expand All @@ -314,13 +314,13 @@ test_that("we can run construct_part_surv_tib",
"ProgressiveDisease",
"Terminal", "Death")
)
expect_identical(class(mixed_dist_part_surv[[1, "part_surv"]]$os),
expect_identical(class(mixed_dist_part_surv[["part_surv"]][[1]]$os),
"lazy")
expect_identical(lazyeval::lazy_eval(mixed_dist_part_surv[[1, "part_surv"]]$pfs),
expect_identical(lazyeval::lazy_eval(mixed_dist_part_surv[["part_surv"]][[1]]$pfs),
'define_survival(distribution = "exp", rate = 1/100)')
expect_identical(class(lazyeval::lazy_eval(mixed_dist_part_surv[[1, "part_surv"]]$os)),
expect_identical(class(lazyeval::lazy_eval(mixed_dist_part_surv[["part_surv"]][[1]]$os)),
"flexsurvreg")
prob <- compute_surv(lazyeval::lazy_eval(mixed_dist_part_surv[[1, "part_surv"]]$os), 1)
prob <- compute_surv(lazyeval::lazy_eval(mixed_dist_part_surv[["part_surv"]][[1]]$os), 1)
expect_equal(round(prob, 5), 0.00213)
})

Expand Down

0 comments on commit 4a32145

Please sign in to comment.