Skip to content

Commit 81540e8

Browse files
committed
lint
1 parent 9d1624f commit 81540e8

File tree

9 files changed

+30
-24
lines changed

9 files changed

+30
-24
lines changed

R/dev_ermod_emax.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#'
2727
#' @return An object of class `ermod_emax`.or `ermod_bin_emax`.
2828
#'
29-
#' @examplesIf BayesERtools:::.if_run_plot_er()
29+
#' @examplesIf BayesERtools:::.if_run_ex_plot_er()
3030
#' \donttest{
3131
#' data_er_cont <- rstanemax::exposure.response.sample
3232
#'
@@ -178,7 +178,7 @@ dev_ermod_emax_exp_sel <- function(
178178

179179
#' @export
180180
#' @rdname dev_ermod_emax
181-
#' @examplesIf BayesERtools:::.if_run_plot_er()
181+
#' @examplesIf BayesERtools:::.if_run_ex_plot_er()
182182
#' \donttest{
183183
#' data_er_bin <- rstanemax::exposure.response.sample.binary
184184
#'

R/dev_ermod_lin.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,4 +749,3 @@ capture_selected_args <- function(arg_names, env) {
749749
.if_run_ex_covsel <- function() {
750750
requireNamespace("projpred", quietly = TRUE)
751751
}
752-

man/dev_ermod_emax.Rd

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

tests/testthat/test-build_spec_coveff.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ if (.if_run_ex_coveff()) {
3434

3535
coveffsim1 <- sim_coveff(ermod_bin, spec_coveff = spec_coveff_new)
3636
coveffsim2 <- sim_coveff(ermod_bin, spec_coveff = spec_coveff_no_keep_ref)
37-
coveffsim3 <- sim_coveff(ermod_bin, spec_coveff = spec_coveff_no_keep_ref_race)
37+
coveffsim3 <-
38+
sim_coveff(ermod_bin, spec_coveff = spec_coveff_no_keep_ref_race)
3839

3940

40-
# Tests -----------------------------------------------------------------------
41+
# Tests ---------------------------------------------------------------------
4142
test_that("input col & row error", {
4243
expect_error(replace_spec_coveff(
4344
spec_coveff, spec_new_bgluc |> dplyr::select(-value_cont)

tests/testthat/test-coveff.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (.if_run_ex_coveff()) {
99

1010
var_resp <- "AEFLAG"
1111

12-
# develop models --------------------------------------------------------------
12+
# develop models ------------------------------------------------------------
1313
set.seed(1234)
1414
ermod_bin <- dev_ermod_bin(
1515
data = df_er_ae_hgly2,
@@ -25,7 +25,7 @@ if (.if_run_ex_coveff()) {
2525
coveffsim <- sim_coveff(ermod_bin)
2626
coveffsim_2 <- sim_coveff(ermod_bin, spec_coveff = spec_coveff)
2727

28-
# Tests -----------------------------------------------------------------------
28+
# Tests ---------------------------------------------------------------------
2929
test_that("sim_coveff", {
3030
expect_equal(coveffsim, coveffsim_2)
3131
expect_equal(dim(coveffsim), c(14, 12))
@@ -73,8 +73,8 @@ if (.if_run_ex_coveff()) {
7373
expect_equal(
7474
spec_coveff$value_label,
7575
c(
76-
"0.824", "2.31", "4.80", "6.01", "8.19", "10.3", "4.42", "6.09", "7.28",
77-
"White", "Asian", "Black", "No", "Yes"
76+
"0.824", "2.31", "4.80", "6.01", "8.19", "10.3", "4.42", "6.09",
77+
"7.28", "White", "Asian", "Black", "No", "Yes"
7878
)
7979
)
8080
})

tests/testthat/test-dev_ermod_emax.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ test_that("plot_ermod_bin_emax", {
196196
})
197197

198198
test_that("Convert factor as response variable into number", {
199-
plot_er_gof(mod_mtcars_emax, n_bins = 4) |>
200-
expect_error("The breaks for the binned probability ")
201-
plot_er_gof(mod_mtcars_emax, n_bins = 2) |> expect_silent()
199+
if (.if_run_ex_plot_er()) {
200+
plot_er_gof(mod_mtcars_emax, n_bins = 4) |>
201+
expect_error("The breaks for the binned probability ")
202+
plot_er_gof(mod_mtcars_emax, n_bins = 2) |> expect_silent()
203+
}
202204
})

tests/testthat/test-dev_ermod_lin.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,14 @@ test_that("print.ermod_exp_sel prints correct information", {
372372
})
373373

374374
test_that("print.ermod_cov_sel prints correct information", {
375-
out <- cli::cli_fmt({
376-
print(ermod_bin_cov_sel_kfold_dummy)
377-
})
378-
expect_true(any(grepl("Binary ER model", out)))
379-
expect_true(any(grepl("& covariate selection", out)))
380-
expect_true(any(grepl("Use \\`plot_submod_performance\\(\\)\\`", out)))
375+
if (requireNamespace("projpred")) {
376+
out <- cli::cli_fmt({
377+
print(ermod_bin_cov_sel_kfold_dummy)
378+
})
379+
expect_true(any(grepl("Binary ER model", out)))
380+
expect_true(any(grepl("& covariate selection", out)))
381+
expect_true(any(grepl("Use \\`plot_submod_performance\\(\\)\\`", out)))
382+
}
381383
})
382384

383385
# plot.ermod_exp_sel

tests/testthat/test-p_direction.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (.if_run_ex_covsel()){
1+
if (.if_run_ex_covsel()) {
22
d_sim_binom_cov <- d_sim_binom_cov
33

44
id_to_sample <- seq(1, max(d_sim_binom_cov$ID), by = 5)
@@ -15,7 +15,7 @@ if (.if_run_ex_covsel()){
1515
)
1616

1717

18-
# Create ermod_bin objects for testing ---------------------------------------
18+
# Create ermod_bin objects for testing -------------------------------------
1919
set.seed(1234)
2020
ermod_bin <- dev_ermod_bin(
2121
data = df_er_ae_covsel_test,

tests/testthat/test-plot_ermod.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ test_that("plot_er.ersim", {
134134

135135
expect_silent(plot(g1))
136136

137-
plot_er(ersim_curve_2_med_qi, show_orig_data = TRUE) |>
138-
expect_warning("Model has covariate\\(s\\), and only one covariate data")
137+
if (requireNamespace("xgxr")) {
138+
plot_er(ersim_curve_2_med_qi, show_orig_data = TRUE) |>
139+
expect_warning("Model has covariate\\(s\\), and only one covariate data")
140+
}
139141
plot_er(ersim_curve_3_med_qi) |>
140142
expect_error("Model has covariate\\(s\\) and multiple covariate data rows")
141143
})

0 commit comments

Comments
 (0)