Skip to content

Commit

Permalink
Merge pull request #49 from rpact-com/dev/4.0.1
Browse files Browse the repository at this point in the history
rhub workflow file added
  • Loading branch information
fpahlke authored Aug 21, 2024
2 parents ea3a28d + 9795e41 commit 0187716
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 44 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ testthat-problems\.rds
^README\.html$
^codecov\.yml$
Rplots\.pdf
^\.lintr$
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rpact
Title: Confirmatory Adaptive Clinical Trial Design and Analysis
Version: 4.0.1.9247
Date: 2024-08-15
Version: 4.0.1.9248
Date: 2024-08-21
Authors@R: c(
person(
given = "Gernot",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export(getSampleSizeCounts)
export(getSampleSizeMeans)
export(getSampleSizeRates)
export(getSampleSizeSurvival)
export(getSimulationCounts)
export(getSimulationEnrichmentMeans)
export(getSimulationEnrichmentRates)
export(getSimulationEnrichmentSurvival)
Expand Down
17 changes: 8 additions & 9 deletions R/class_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
## |
## | Contact us for information about our services: info@rpact.com
## |
## | File version: $Revision: 8087 $
## | Last changed: $Date: 2024-08-15 16:34:30 +0200 (Do, 15 Aug 2024) $
## | File version: $Revision: 8111 $
## | Last changed: $Date: 2024-08-20 14:20:14 +0200 (Di, 20 Aug 2024) $
## | Last changed by: $Author: pahlke $
## |

Expand Down Expand Up @@ -1641,20 +1641,19 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
return(header)
}

.addAlphaAndBetaToHeader <- function(header, design, designPlan, ..., endOfRecord = FALSE, powerEnabled = NA) {
header <- .concatenateSummaryText(header, paste0(
ifelse(design$sided == 1, "one-sided", "two-sided"),
ifelse(design$kMax == 1, "", " overall")
))
.addAlphaAndBetaToHeader <- function(header, design, designPlan, ..., endOfRecord = FALSE, powerEnabled = NA, sep = ", ") {
if (is.na(powerEnabled)) {
powerEnabled <- .isTrialDesignInverseNormalOrGroupSequential(design) &&
(is.null(designPlan) || (!.isSimulationResults(designPlan) &&
!identical("power", designPlan[[".objectType"]])))
}
header <- .concatenateSummaryText(header,
paste0("significance level ", round(100 * design$alpha, 2), "%",
paste0(
ifelse(design$sided == 1, "one-sided", "two-sided"),
ifelse(design$kMax == 1, "", " overall"),
" significance level ", round(100 * design$alpha, 2), "%",
ifelse(!powerEnabled && endOfRecord, ".", "")),
sep = " "
sep = sep
)
if (powerEnabled) {
header <- .concatenateSummaryText(header,
Expand Down
8 changes: 4 additions & 4 deletions R/f_design_general_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
## |
## | Contact us for information about our services: info@rpact.com
## |
## | File version: $Revision: 8087 $
## | Last changed: $Date: 2024-08-15 16:34:30 +0200 (Do, 15 Aug 2024) $
## | File version: $Revision: 8104 $
## | Last changed: $Date: 2024-08-19 10:30:01 +0200 (Mo, 19 Aug 2024) $
## | Last changed by: $Author: pahlke $
## |

Expand All @@ -27,7 +27,7 @@ NULL
}

.getDefaultDesign <- function(...,
type = c("sampleSize", "power", "simulation", "analysis", "characteristics"),
type = c("sampleSize", "power", "simulation", "simulationCounts", "analysis", "characteristics"),
ignore = c()) {
type <- match.arg(type)

Expand All @@ -54,7 +54,7 @@ NULL

twoSidedPower <- .getOptionalArgument("twoSidedPower", ...)
if (is.null(twoSidedPower)) {
if (type %in% c("power", "simulation") && sided == 2) {
if (type %in% c("power", "simulation", "simulationCounts") && sided == 2) {
twoSidedPower <- TRUE
} else {
twoSidedPower <- C_TWO_SIDED_POWER_DEFAULT
Expand Down
16 changes: 10 additions & 6 deletions R/f_design_group_sequential.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
## |
## | Contact us for information about our services: info@rpact.com
## |
## | File version: $Revision: 7742 $
## | Last changed: $Date: 2024-03-22 13:46:29 +0100 (Fr, 22 Mrz 2024) $
## | Last changed by: $Author: pahlke $
## | File version: $Revision: 8112 $
## | Last changed: $Date: 2024-08-20 15:44:53 +0200 (Di, 20 Aug 2024) $
## | Last changed by: $Author: wassmer $
## |

#' @include f_core_constants.R
Expand All @@ -38,9 +38,9 @@ NULL
#' Given a sequence of information rates (fixing the correlation structure), and
#' decisionMatrix with either 2 or 4 rows and kMax = length(informationRates) columns,
#' this function calculates a probability matrix containing, for two rows, the probabilities:\cr
#' P(Z_1 <- l_1), P(l_1 <- Z_1 < u_1, Z_2 < l_1),..., P(l_kMax-1 <- Z_kMax-1 < u_kMax-1, Z_kMax < l_l_kMax)\cr
#' P(Z_1 <- u_1), P(l_1 <- Z_1 < u_1, Z_2 < u_1),..., P(l_kMax-1 <- Z_kMax-1 < u_kMax-1, Z_kMax < u_l_kMax)\cr
#' P(Z_1 <- Inf), P(l_1 <- Z_1 < u_1, Z_2 < Inf),..., P(l_kMax-1 <- Z_kMax-1 < u_kMax-1, Z_kMax < Inf)\cr
#' P(Z_1 < l_1), P(l_1 < Z_1 < u_1, Z_2 < l_2),..., P(l_kMax-1 < Z_kMax-1 < u_kMax-1, Z_kMax < l_l_kMax)\cr
#' P(Z_1 < u_1), P(l_1 < Z_1 < u_1, Z_2 < u_2),..., P(l_kMax-1 < Z_kMax-1 < u_kMax-1, Z_kMax < u_l_kMax)\cr
#' P(Z_1 < Inf), P(l_1 < Z_1 < u_1, Z_2 < Inf),..., P(l_kMax-1 < Z_kMax-1 < u_kMax-1, Z_kMax < Inf)\cr
#' with continuation matrix\cr
#' l_1,...,l_kMax\cr
#' u_1,...,u_kMax\cr
Expand Down Expand Up @@ -423,6 +423,10 @@ getGroupSequentialProbabilities <- function(decisionMatrix, informationRates) {
.getDesignGroupSequentialKMax1 <- function(design) {
design$criticalValues <- .getOneMinusQNorm(design$alpha / design$sided)
design$alphaSpent[1] <- design$alpha
design$.setParameterType("typeOfDesign", C_PARAM_NOT_APPLICABLE)
if (!identical(design$typeOfDesign, C_DEFAULT_TYPE_OF_DESIGN)) {
warning("'typeOfDesign' (", design$typeOfDesign, ") will be ignored because design is fixed", call. = FALSE)
}
return(invisible(design))
}

Expand Down
24 changes: 11 additions & 13 deletions R/f_simulation_base_count_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
## |
## | Contact us for information about our services: info@rpact.com
## |
## | File version: $Revision: 8052 $
## | Last changed: $Date: 2024-07-18 11:19:40 +0200 (Do, 18 Jul 2024) $
## | Last changed by: $Author: pahlke $
## | File version: $Revision: 8112 $
## | Last changed: $Date: 2024-08-20 15:44:53 +0200 (Di, 20 Aug 2024) $
## | Last changed by: $Author: wassmer $
## |

.getInformationCountData <- function(lambda1,
Expand Down Expand Up @@ -101,18 +101,14 @@
#' @inheritParams param_accrualTime_counts
#' @inheritParams param_accrualIntensity_counts
#' @inheritParams param_followUpTime_counts
#' @inheritParams param_maxNumberOfSubjects
#' @inheritParams param_overdispersion_counts
#' @inheritParams param_directionUpper
#' @inheritParams param_allocationRatioPlanned
#' @inheritParams param_plannedSubjects
#' @inheritParams param_minNumberOfSubjectsPerStage
#' @inheritParams param_maxNumberOfSubjectsPerStage
#' @inheritParams param_conditionalPowerSimulation
#' @inheritParams param_maxNumberOfSubjects_counts
#' @inheritParams param_maxNumberOfIterations
#' @inheritParams param_calcSubjectsFunction
#' @inheritParams param_seed
#' @inheritParams param_three_dots
#' @inheritParams param_calcSubjectsFunction
#' @inheritParams param_showStatistics
#'
#' @details
Expand Down Expand Up @@ -156,8 +152,10 @@
#'
#' @template return_object_simulation_results
#' @template how_to_get_help_for_generics
#'
#' @template examples_get_simulation_counts
#'
#' @keywords internal
#' @export
#'
getSimulationCounts <- function(design = NULL,
...,
Expand All @@ -183,7 +181,7 @@ getSimulationCounts <- function(design = NULL,
directionUpper <- TRUE
}
if (is.null(design)) {
design <- .getDefaultDesign(..., type = "simulation")
design <- .getDefaultDesign(..., type = "simulationCounts")
.warnInCaseOfUnknownArguments(
functionName = "getSimulationCounts",
ignore = .getDesignArgumentsToIgnoreAtUnknownArgumentCheck(
Expand All @@ -192,7 +190,7 @@ getSimulationCounts <- function(design = NULL,
)
)
} else {
.assertIsTrialDesign(design)
.assertIsTrialDesignGroupSequential(design)
.warnInCaseOfUnknownArguments(
functionName = "getSimulationCounts",
ignore = c("showStatistics"), ...
Expand Down Expand Up @@ -426,7 +424,7 @@ getSimulationCounts <- function(design = NULL,
dfStartStop$output[, "recruitTime"] <= plannedCalendarTime[k] &
dfStartStop$output[, "stopCalendar"] <= plannedCalendarTime[k],
]
if (length(kthStageWithEvents) > 0 && nrow(kthStageWithEvents) > 0) {
if (length(kthStageWithEvents) > 0 && is.matrix(kthStageWithEvents) && nrow(kthStageWithEvents) > 0) {
tab <- table(kthStageWithEvents[, "id"])
idx <- as.integer(names(tab))
counts[idx] <- as.vector(tab)
Expand Down
12 changes: 8 additions & 4 deletions R/parameter_descriptions.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
## |
## | Contact us for information about our services: info@rpact.com
## |
## | File version: $Revision: 7941 $
## | Last changed: $Date: 2024-05-28 08:44:36 +0200 (Di, 28 Mai 2024) $
## | Last changed by: $Author: pahlke $
## | File version: $Revision: 8112 $
## | Last changed: $Date: 2024-08-20 15:44:53 +0200 (Di, 20 Aug 2024) $
## | Last changed by: $Author: wassmer $
## |

#' Parameter Description: "..."
Expand Down Expand Up @@ -344,7 +344,11 @@ NULL
#' @keywords internal
NULL


#' Parameter Description: plannedMaxSubjects for Counts
#' @param plannedMaxSubjects \code{plannedMaxSubjects > 0} needs to be specified.
#' @name param_maxNumberOfSubjects_counts
#' @keywords internal
NULL

##
## Analysis
Expand Down
4 changes: 2 additions & 2 deletions inst/doc/rpact_getting_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Friedrich Pahlke and Gernot Wassmer" />

<meta name="date" content="2024-08-15" />
<meta name="date" content="2024-08-19" />

<title>Getting started with rpact</title>

Expand Down Expand Up @@ -239,7 +239,7 @@

<h1 class="title toc-ignore">Getting started with rpact</h1>
<h4 class="author">Friedrich Pahlke and Gernot Wassmer</h4>
<h4 class="date">2024-08-15</h4>
<h4 class="date">2024-08-19</h4>



Expand Down
6 changes: 3 additions & 3 deletions man/getGroupSequentialProbabilities.Rd

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

28 changes: 27 additions & 1 deletion man/getSimulationCounts.Rd

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

0 comments on commit 0187716

Please sign in to comment.