Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Nov 22, 2023
1 parent 693277c commit bd5cec3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
8 changes: 3 additions & 5 deletions R/adjust.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,10 @@ adjust_infection_to_report <- function(infections, delay_defs,
deprecate_warn(
"2.0.0",
"adjust_infection_to_report(delay_defs = 'should be a dist_spec')",
details = c(
"Specifying this as a list of data tables is deprecated."
)
details = "Specifying this as a list of data tables is deprecated."
)
report <- sample_single_dist(infections, delay_defs[[1]])
if (length(delay_defs ) > 1) {
if (length(delay_defs) > 1) {
for (def in 2:length(delay_defs)) {
report <- sample_single_dist(report, delay_defs[[def]])

Check warning on line 156 in R/adjust.R

View check run for this annotation

Codecov / codecov/patch

R/adjust.R#L155-L156

Added lines #L155 - L156 were not covered by tests
}
Expand Down Expand Up @@ -181,7 +179,7 @@ adjust_infection_to_report <- function(infections, delay_defs,
}

## Truncate reported cases by maximum infection date
if (type %in% "sample" && truncate_future) {
if (type == "sample" && truncate_future) {
report <- report[date <= max(infections$date)]
}
return(report)
Expand Down
6 changes: 3 additions & 3 deletions R/dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ dist_skel <- function(n, dist = FALSE, cum = TRUE, model,
plnorm(n, params[["meanlog"]], params[["sdlog"]])) /
plnorm(max_value + 1, params[["meanlog"]], params[["sdlog"]])
}
} else if (model %in% "normal") {
} else if (model == "normal") {
rdist <- function(n) {
rnorm(n, params[["mean"]], params[["sd"]])

Check warning on line 132 in R/dist.R

View check run for this annotation

Codecov / codecov/patch

R/dist.R#L132

Added line #L132 was not covered by tests
}
Expand Down Expand Up @@ -903,7 +903,7 @@ dist_spec <- function(distribution = c(
"dist_spec(fixed)",
"fix_dist()"

Check warning on line 904 in R/dist.R

View check run for this annotation

Codecov / codecov/patch

R/dist.R#L901-L904

Added lines #L901 - L904 were not covered by tests
)
params_sd <- c()
params_sd <- NULL

Check warning on line 906 in R/dist.R

View check run for this annotation

Codecov / codecov/patch

R/dist.R#L906

Added line #L906 was not covered by tests
}
## check for deprecated parameters
if (!all(missing(mean), missing(sd), missing(mean_sd), missing(sd_sd)) &&
Expand Down Expand Up @@ -941,7 +941,7 @@ dist_spec <- function(distribution = c(
params_sd <- c(mean = mean_sd, sd = sd_sd)
} else if (distribution == "fixed") {
params_mean <- mean
params_sd <- c()
params_sd <- NULL

Check warning on line 944 in R/dist.R

View check run for this annotation

Codecov / codecov/patch

R/dist.R#L937-L944

Added lines #L937 - L944 were not covered by tests
}
}
return(.dist_spec(distribution, params_mean, params_sd, max, pmf))
Expand Down
2 changes: 1 addition & 1 deletion R/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ get_regions <- function(results_dir) {
)

# put into alphabetical order
regions <- regions[!(regions %in% "runtimes.csv")]
regions <- regions[!(regions == "runtimes.csv")]

Check warning on line 19 in R/get.R

View check run for this annotation

Codecov / codecov/patch

R/get.R#L19

Added line #L19 was not covered by tests
regions <- sort(regions)
names(regions) <- regions
return(regions)
Expand Down
2 changes: 1 addition & 1 deletion R/report.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ report_summary <- function(summarised_estimates,
}

if (!is.null(target_folder)) {
saveRDS(summary, paste0(target_folder, "/summary.rds"))
saveRDS(summary, file.path(target_folder, "summary.rds"))
}
return(summary)
}
Expand Down
4 changes: 2 additions & 2 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ make_conf <- function(value, CrI = 90, reverse = FALSE) {
)
conf <- paste0(
value$median, " (",
ifelse(!reverse, CrI$lower, CrI$upper), " -- ",
ifelse(!reverse, CrI$upper, CrI$lower), ")"
ifelse(reverse, CrI$upper, CrI$lower), " -- ",
ifelse(reverse, CrI$lower, CrI$upper), ")"
)
return(conf)
}
Expand Down

0 comments on commit bd5cec3

Please sign in to comment.