Skip to content

Commit

Permalink
Change argument name to titleAnalysisLegend
Browse files Browse the repository at this point in the history
  • Loading branch information
jdblischak committed Feb 8, 2024
1 parent 7b55f56 commit 6373663
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: gsDesign
Version: 3.6.0.2
Version: 3.6.0.3
Title: Group Sequential Design
Authors@R: person(given = "Keaven", family = "Anderson", email =
"keaven_anderson@merck.com", role = c('aut','cre'))
Expand Down
14 changes: 7 additions & 7 deletions R/gsqplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -815,21 +815,21 @@ plotASN <- function(x, xlab = NULL, ylab = NULL, main = NULL, theta = NULL, xval
#' @param offset Integer to offset the numeric labels of the "Analysis" legend
#' (default: 0). Only relevant for \code{outtype = 1}. By default will change
#' legend title to "Future Analysis". To customize the title, pass the label
#' to the argument \code{titleAnalysisCustom}
#' @param titleAnalysisCustom Label to use as the title for the "Analysis"
#' to the argument \code{titleAnalysisLegend}
#' @param titleAnalysisLegend Label to use as the title for the "Analysis"
#' legend (default: NULL)
# plotgsPower function [sinew] ----
plotgsPower <- function(x, main = "Boundary crossing probabilities by effect size",
ylab = "Cumulative Boundary Crossing Probability",
xlab = NULL, lty = NULL, col = NULL, lwd = 1, cex = 1,
theta = if (inherits(x, "gsDesign")) seq(0, 2, .05) * x$delta else x$theta,
xval = NULL, base = FALSE, outtype = 1, offset = 0,
titleAnalysisCustom = NULL, ...) {
titleAnalysisLegend = NULL, ...) {

stopifnot(
is.numeric(offset) && length(offset) == 1,
is.null(titleAnalysisCustom) ||
(is.character(titleAnalysisCustom) && length(titleAnalysisCustom) == 1)
is.null(titleAnalysisLegend) ||
(is.character(titleAnalysisLegend) && length(titleAnalysisLegend) == 1)
)
if (is.null(xval)) {
if (inherits(x, "gsDesign")) {
Expand Down Expand Up @@ -879,8 +879,8 @@ plotgsPower <- function(x, main = "Boundary crossing probabilities by effect siz
if (offset > 0) {
titleAnalysis <- "Future Analysis"
}
if (!is.null(titleAnalysisCustom)) {
titleAnalysis <- titleAnalysisCustom
if (!is.null(titleAnalysisLegend)) {
titleAnalysis <- titleAnalysisLegend
}

y2$delta <- xval[y$thetaidx]
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-independent-test-plotgsPower.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ test_that(desc = 'Test: plotgsPower graphs can use offset arg for Future Analysi
)

# Enable custom legend title
plotobj <- plotgsPower(x, titleAnalysisCustom = "custom")
plotobj <- plotgsPower(x, titleAnalysisLegend = "custom")

expect_equal(
plotobj[["plot_env"]][["titleAnalysis"]],
"custom"
)

plotobj <- plotgsPower(x, offset = 1, titleAnalysisCustom = "custom")
plotobj <- plotgsPower(x, offset = 1, titleAnalysisLegend = "custom")

expect_equal(
plotobj[["plot_env"]][["titleAnalysis"]],
Expand Down

0 comments on commit 6373663

Please sign in to comment.