Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change argument name to titleAnalysisLegend #123

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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