Skip to content

Commit

Permalink
Fixed bug from using new version of ggplot2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jepusto committed Nov 7, 2022
1 parent 292e08b commit 693114f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion R/graphing-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ graph_SCD <- function(design, case, phase, session, outcome,

dat$fitted <- if(design == "CMB") predict(model_fit, level = 1) else predict(model_fit)

p <- p + ggplot2::geom_line(data = dat, ggplot2::aes(y = fitted), size = 0.8)
p <- p + ggplot2::geom_line(data = dat, ggplot2::aes(y = fitted), linewidth = 0.8)

}

Expand Down
15 changes: 4 additions & 11 deletions tests/testthat/test_graphing_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ context("Graphing functions")
test_that("graph_SCD works for design = 'TR'", {

skip_if_not_installed("ggplot2")
skip_on_cran()

data("Anglesea")

Expand Down Expand Up @@ -50,8 +49,6 @@ test_that("graph_SCD works for design = 'MBP'", {

skip_if_not_installed("ggplot2")

skip_on_cran()

data("Laski")

Laski_RML <- lme(fixed = outcome ~ 1 + treatment,
Expand All @@ -69,17 +66,15 @@ test_that("graph_SCD works for design = 'MBP'", {
expect_s3_class(Laski_graph2, "ggplot")
expect_invisible(print(Laski_graph2))

keys <- setdiff(names(Laski_graph1), c("plot_env", "labels","facet"))
keys <- setdiff(names(Laski_graph1), c("plot_env", "labels","layers"))
expect_equal(Laski_graph1[keys], Laski_graph2[keys])

})

test_that("graph_SCD works for design = 'RMBB'", {

skip_if_not_installed("ggplot2")

skip_on_cran()


data("Thiemann2001")
Thiemann2001_RML <- lme(outcome ~ 1 + time_c + treatment + trt_time,
random = ~ 1 | case / series,
Expand Down Expand Up @@ -113,7 +108,7 @@ test_that("graph_SCD works for design = 'RMBB'", {
expect_s3_class(Thiemann_graph3, "ggplot")
expect_invisible(print(Thiemann_graph3))

keys <- setdiff(names(Thiemann_graph1), c("plot_env", "labels", "facet"))
keys <- setdiff(names(Thiemann_graph1), c("plot_env", "labels", "layers"))
expect_equal(Thiemann_graph1[keys], Thiemann_graph3[keys])

})
Expand All @@ -122,8 +117,6 @@ test_that("graph_SCD works for design = 'CMB'", {

skip_if_not_installed("ggplot2")

skip_on_cran()

data("Bryant2018")

Bryant2018_RML <-lme(fixed = outcome ~ treatment,
Expand Down Expand Up @@ -160,7 +153,7 @@ test_that("graph_SCD works for design = 'CMB'", {
expect_s3_class(Bry_graph3, "ggplot")
expect_invisible(print(Bry_graph3))

keys <- setdiff(names(Bry_graph1), c("plot_env", "labels", "facet"))
keys <- setdiff(names(Bry_graph1), c("plot_env", "labels", "layers"))
expect_equal(Bry_graph1[keys], Bry_graph3[keys])

})
Expand Down

0 comments on commit 693114f

Please sign in to comment.