Skip to content

Commit

Permalink
Auto code formatting. Regenerating documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schuemie authored and Schuemie committed May 25, 2022
1 parent 8e16cd9 commit ce92cd4
Show file tree
Hide file tree
Showing 95 changed files with 6,594 additions and 10,121 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: SelfControlledCaseSeries
Type: Package
Title: Self-Controlled Case Series
Version: 3.3.0
Date: 2022-04-04
Date: 2022-05-25
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre")),
person("Patrick", "Ryan", role = c("aut")),
Expand Down
12 changes: 8 additions & 4 deletions R/Analyses.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ createSccsAnalysis <- function(analysisId = 1,
checkmate::assertClass(createScriIntervalDataArgs, "args", null.ok = TRUE, add = errorMessages)
checkmate::assertClass(fitSccsModelArgs, "args", add = errorMessages)
checkmate::reportAssertions(collection = errorMessages)
if (toupper(design) == "SCCS" && is.null(createSccsIntervalDataArgs))
if (toupper(design) == "SCCS" && is.null(createSccsIntervalDataArgs)) {
stop("Must provide createSccsIntervalDataArgs argument when design = 'SCCS'")
if (toupper(design) == "SCRI" && is.null(createScriIntervalDataArgs))
}
if (toupper(design) == "SCRI" && is.null(createScriIntervalDataArgs)) {
stop("Must provide createScriIntervalDataArgs argument when design = 'SCRI'")
}
analysis <- list()
for (name in names(formals(createSccsAnalysis))) {
analysis[[name]] <- get(name)
Expand Down Expand Up @@ -132,10 +134,12 @@ loadSccsAnalysisList <- function(file) {
#' @export
createExposureOutcome <- function(exposureId, outcomeId, ...) {
errorMessages <- checkmate::makeAssertCollection()
if (!is.list(exposureId))
if (!is.list(exposureId)) {
checkmate::assertInt(exposureId, add = errorMessages)
if (!is.list(outcomeId))
}
if (!is.list(outcomeId)) {
checkmate::assertInt(outcomeId, add = errorMessages)
}
checkmate::reportAssertions(collection = errorMessages)

exposureOutcome <- list(...)
Expand Down
33 changes: 19 additions & 14 deletions R/CovariateSettings.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ createEraCovariateSettings <- function(includeEraIds = NULL,
checkmate::assertLogical(allowRegularization, len = 1, add = errorMessages)
checkmate::assertLogical(profileLikelihood, len = 1, add = errorMessages)
checkmate::reportAssertions(collection = errorMessages)
if (allowRegularization && profileLikelihood)
if (allowRegularization && profileLikelihood) {
stop("Cannot profile the likelihood of regularized covariates")
}
if (!grepl("start$|end$", startAnchor, ignore.case = TRUE)) {
stop("startAnchor should have value 'era start' or 'era end'")
}
Expand All @@ -98,8 +99,9 @@ createEraCovariateSettings <- function(includeEraIds = NULL,
isEnd <- function(anchor) {
return(grepl("end$", anchor, ignore.case = TRUE))
}
if (end < start && !isEnd(endAnchor))
if (end < start && !isEnd(endAnchor)) {
stop("End day always precedes start day. Either pick a later end day, or set endAnchor to 'era end'.")
}

# Make sure string is exact:
if (isEnd(startAnchor)) {
Expand Down Expand Up @@ -315,8 +317,9 @@ createControlIntervalSettings <- function(includeEraIds = NULL,
isEnd <- function(anchor) {
return(grepl("end$", anchor, ignore.case = TRUE))
}
if (end < start && !isEnd(endAnchor))
if (end < start && !isEnd(endAnchor)) {
stop("End day always precedes start day. Either pick a later end day, or set endAnchor to 'era end'.")
}

# Make sure string is exact:
if (isEnd(startAnchor)) {
Expand All @@ -329,17 +332,19 @@ createControlIntervalSettings <- function(includeEraIds = NULL,
} else {
endAnchor <- "era start"
}
analysis <- createEraCovariateSettings(includeEraIds = includeEraIds,
excludeEraIds = excludeEraIds,
label = "Control interval",
stratifyById = FALSE,
start = start,
startAnchor = startAnchor,
end = end,
endAnchor = endAnchor,
firstOccurrenceOnly = firstOccurrenceOnly,
splitPoints = c(),
allowRegularization = FALSE)
analysis <- createEraCovariateSettings(
includeEraIds = includeEraIds,
excludeEraIds = excludeEraIds,
label = "Control interval",
stratifyById = FALSE,
start = start,
startAnchor = startAnchor,
end = end,
endAnchor = endAnchor,
firstOccurrenceOnly = firstOccurrenceOnly,
splitPoints = c(),
allowRegularization = FALSE
)
analysis$isControlInterval <- TRUE
class(analysis) <- "ControlIntervalSettings"
return(analysis)
Expand Down
Loading

0 comments on commit ce92cd4

Please sign in to comment.