Skip to content

Commit

Permalink
699 remove multiplot (#700)
Browse files Browse the repository at this point in the history
* Remove multiplot

* Correct typo

* Correcting typo in argument to assert_integerish
  • Loading branch information
Puzzled-Face authored Oct 11, 2023
1 parent 4a86b56 commit f16e814
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 93 deletions.
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ export(maxDose)
export(maxSize)
export(mcmc)
export(minSize)
export(multiplot)
export(nextBest)
export(ngrid)
export(plotDualResponses)
Expand Down Expand Up @@ -521,9 +520,6 @@ importFrom(graphics,lines)
importFrom(graphics,matlines)
importFrom(graphics,matplot)
importFrom(graphics,plot)
importFrom(grid,grid.newpage)
importFrom(grid,pushViewport)
importFrom(grid,viewport)
importFrom(gridExtra,arrangeGrob)
importFrom(kableExtra,add_footnote)
importFrom(kableExtra,add_header_above)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Version 1.0.9000.9133
* Removed `multiplot` function. Use Please use equivalent functionality in other packages, such as `cowplot` or `ggpubr`.
* Added new `DataGrouped` and `DesignGrouped` classes with corresponding model `LogisticLogNormalGrouped` to support simultaneous dose escalation with monotherapy and combination therapy arms.
* Created the `CrmPackClass` class as the ultimate ancestor of all other
`crmPack` classes to allow identification of crmPack classes and simpler
Expand Down
12 changes: 8 additions & 4 deletions R/Rules-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,8 @@ setClass(
#' @example examples/Rules-class-CohortSizeRange.R
#'
CohortSizeRange <- function(intervals, cohort_size) {
assert_integerish(cohort_size, lower = 1, any.missing = FALSE)
# Cohort size 0 is needed to allow for no-placebo designs
assert_integerish(cohort_size, lower = 0, any.missing = FALSE)

.CohortSizeRange(
intervals = intervals,
Expand Down Expand Up @@ -2759,7 +2760,8 @@ CohortSizeRange <- function(intervals, cohort_size) {
#'
CohortSizeDLT <- function(intervals, cohort_size) {
assert_integerish(intervals, lower = 0, any.missing = FALSE)
assert_integerish(cohort_size, lower = 1, any.missing = FALSE)
# Cohort size 0 is needed to allow for no-placebo designs
assert_integerish(cohort_size, lower = 0, any.missing = FALSE)

.CohortSizeDLT(
intervals = as.integer(intervals),
Expand Down Expand Up @@ -2810,7 +2812,8 @@ CohortSizeDLT <- function(intervals, cohort_size) {
#' @example examples/Rules-class-CohortSizeConst.R
#'
CohortSizeConst <- function(size) {
assert_integerish(size, min = 1)
# Cohort size 0 is needed to allow for no-placebo designs
assert_integerish(size, lower = 0)
.CohortSizeConst(size = as.integer(size))
}

Expand Down Expand Up @@ -2859,7 +2862,8 @@ CohortSizeConst <- function(size) {
#' @example examples/Rules-class-CohortSizeParts.R
#'
CohortSizeParts <- function(cohort_sizes) {
assert_integerish(cohort_sizes, min = 1, any.missing = FALSE)
# Cohort size 0 is needed to allow for no-placebo designs
assert_integerish(cohort_sizes, lower = 0, any.missing = FALSE)
.CohortSizeParts(cohort_sizes = as.integer(cohort_sizes))
}

Expand Down
57 changes: 0 additions & 57 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,63 +219,6 @@ crmPackHelp <- function() {
utils::help(package = "crmPack", help_type = "html")
}

#' Multiple plot function
#'
#' ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects).
#' If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
#' then plot 1 will go in the upper left, 2 will go in the upper right, and
#' 3 will go all the way across the bottom.
#'
#' @param \dots Objects to be passed
#' @param plotlist a list of additional objects
#' @param rows Number of rows in layout
#' @param layout A matrix specifying the layout. If present, \code{rows}
#' is ignored.
#'
#' @return Used for the side effect of plotting
#' @importFrom grid grid.newpage pushViewport viewport
#' @export
multiplot <- function(..., plotlist = NULL, rows = 1, layout = NULL) {
# Make a list from the ... arguments and plotlist
plots <- c(list(...), plotlist)

numPlots <- length(plots)

# If layout is NULL, then use 'cols' to determine layout
if (is.null(layout)) {
# Make the panel
# ncol: Number of columns of plots
# nrow: Number of rows needed, calculated from # of cols
layout <- matrix(seq(1, rows * ceiling(numPlots / rows)),
nrow = rows, ncol = ceiling(numPlots / rows),
byrow = TRUE
)
}

if (numPlots == 1) {
print(plots[[1]])
} else {
# Set up the page
grid::grid.newpage()
grid::pushViewport(grid::viewport(layout = grid::grid.layout(
nrow(layout),
ncol(layout)
)))

# Make each plot, in the correct location
for (i in seq_len(numPlots))
{
# Get the i,j matrix positions of the regions that contain this subplot
matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))

print(plots[[i]], vp = grid::viewport(
layout.pos.row = matchidx$row,
layout.pos.col = matchidx$col
))
}
}
}

##' Taken from utils package (print.vignette)
##'
##' @importFrom tools file_ext
Expand Down
1 change: 0 additions & 1 deletion _pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ reference:
- matchTolerance
- maxSize
- minSize
- multiplot
- or-Stopping-Stopping
- or-Stopping-StoppingAny
- or-StoppingAny-Stopping
Expand Down
20 changes: 20 additions & 0 deletions man/is.wholenumber.Rd

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

27 changes: 0 additions & 27 deletions man/multiplot.Rd

This file was deleted.

18 changes: 18 additions & 0 deletions man/safeInteger.Rd

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

0 comments on commit f16e814

Please sign in to comment.