Skip to content

Commit 4a2ffb3

Browse files
authored
Merge pull request #440 from UCD-SERG/feat/issue439/revert-to-est_seroincidence_by-2
Update estimate_scr to est_seroincidence_by
2 parents 2ab22b9 + 6cc8712 commit 4a2ffb3

40 files changed

Lines changed: 321 additions & 107 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: serocalculator
33
Title: Estimating Infection Rates from Serological Data
4-
Version: 1.3.0.9046
4+
Version: 1.3.0.9047
55
Authors@R: c(
66
person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"),
77
comment = "Author of the method and original code."),

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export(count_strata)
2424
export(est.incidence)
2525
export(est.incidence.by)
2626
export(est_seroincidence)
27-
export(estimate_scr_by)
27+
export(est_seroincidence_by)
2828
export(f_dev)
2929
export(f_dev0)
3030
export(fdev)

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## New features
44

5+
* Rename `estimate_scr()` to `est_seroincidence_by()` (#439)
56
* Rename `estimate_scr()` to `est_seroincidence()` (#432)
67
* Rename argument `curve_params` to `sr_params` (#424)
78
* added documentation for `count_strata()` (#431)

R/autoplot.seroincidence.by.R

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#' Plot `seroincidence.by` log-likelihoods
22
#' @description
33
#' Plots log-likelihood curves by stratum, for `seroincidence.by` objects
4-
#' @param object a '"seroincidence.by"' object (from [estimate_scr_by()])
4+
#' @param object a '"seroincidence.by"' object (from [est_seroincidence_by()])
55
#' @param ncol number of columns to use for panel of plots
66
#' @inheritDotParams autoplot.seroincidence
7-
#' @return an object of class `"ggarrange"`, which is a [ggplot2::ggplot()] or a [list()] of [ggplot2::ggplot()]s.
7+
#' @return a `"ggarrange"` object: a single or [list()] of [ggplot2::ggplot()]s
88
#' @export
99
#' @examples
1010
#'\donttest{
@@ -21,7 +21,7 @@
2121
#' noise <-
2222
#' example_noise_params_pk
2323
#'
24-
#' est2 <- estimate_scr_by(
24+
#' est2 <- est_seroincidence_by(
2525
#' strata = c("catchment"),
2626
#' pop_data = xs_data,
2727
#' curve_params = curve,
@@ -36,7 +36,7 @@
3636
#' # Plot the log-likelihood curve
3737
#' autoplot(est2)
3838
#'}
39-
autoplot.seroincidence.by = function(
39+
autoplot.seroincidence.by <- function(
4040
object,
4141
ncol = min(3, length(object)),
4242
...) {
@@ -47,16 +47,15 @@ autoplot.seroincidence.by = function(
4747
if (!attr(object, "graphs_included")) {
4848
stop(
4949
"Graphs cannot be extracted; ",
50-
"`build_graph` was not `TRUE` in the call to `estimate_scr_by()`"
50+
"`build_graph` was not `TRUE` in the call to `est_seroincidence_by()`"
5151
)
5252
figure <- NULL
5353
}
5454

5555
labels <- names(object)
5656
figs <- lapply(object, FUN = autoplot.seroincidence, ...)
5757

58-
for (i in 1:length(figs))
59-
{
58+
for (i in seq_along(figs)){
6059
figs[[i]] <- figs[[i]] + ggplot2::ggtitle(labels[i])
6160
}
6261

R/autoplot.summary.seroincidence.by.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @param object
44
#' a `summary.seroincidence.by` object
55
#' (generated by applying the `summary()`
6-
#' method to the output of [estimate_scr_by()]).
6+
#' method to the output of [est_seroincidence_by()]).
77
#' @param type
88
#' [character] string indicating which type of plot to generate.
99
#' The implemented options are:
@@ -29,7 +29,7 @@
2929
#' noise <-
3030
#' example_noise_params_pk
3131
#'
32-
#' est2 <- estimate_scr_by(
32+
#' est2 <- est_seroincidence_by(
3333
#' strata = c("catchment", "ageCat"),
3434
#' pop_data = xs_data,
3535
#' curve_params = curve,

R/check_parallel_cores.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ check_parallel_cores <- function(num_cores) {
1111
c(
1212
"This computer appears to have
1313
{parallel::detectCores()} cores available.
14-
`estimate_scr_by()` has reduced its
14+
`est_seroincidence_by()` has reduced its
1515
`num_cores` argument to {num_cores}
1616
to avoid destabilizing the computer."
1717
)
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' If `strata` is left empty, a warning will be produced,
2424
#' recommending that you use [est_seroincidence()] for unstratified analyses,
2525
#' and then the data will be passed to [est_seroincidence()].
26-
#' If for some reason you want to use [estimate_scr_by()]
26+
#' If for some reason you want to use [est_seroincidence_by()]
2727
#' with no strata instead of calling [est_seroincidence()],
2828
#' you may use `NA`, `NULL`, or `""` as the `strata`
2929
#' argument to avoid that warning.
@@ -57,7 +57,7 @@
5757
#' noise <-
5858
#' example_noise_params_pk
5959
#'
60-
#' est2 <- estimate_scr_by(
60+
#' est2 <- est_seroincidence_by(
6161
#' strata = "catchment",
6262
#' pop_data = xs_data,
6363
#' curve_params = curve,
@@ -69,7 +69,7 @@
6969
#' print(est2)
7070
#' summary(est2)
7171
#'
72-
estimate_scr_by <- function(
72+
est_seroincidence_by <- function(
7373
pop_data,
7474
curve_params,
7575
noise_params,
@@ -275,14 +275,15 @@ estimate_scr_by <- function(
275275
#' @description
276276
#' `r lifecycle::badge("deprecated")`
277277
#'
278-
#' `est.incidence.by()` was renamed to [estimate_scr_by()] to create a more
278+
#' `est.incidence.by()` was renamed to [est_seroincidence_by()] to create a more
279279
#' consistent API.
280280
#' @keywords internal
281281
#' @export
282282
est.incidence.by <- function( # nolint: object_name_linter
283283
...) {
284-
lifecycle::deprecate_soft("1.3.1", "est.incidence.by()", "estimate_scr_by()")
285-
estimate_scr_by(
284+
lifecycle::deprecate_soft("1.4.0", "est.incidence.by()",
285+
"est_seroincidence_by()")
286+
est_seroincidence_by(
286287
...
287288
)
288289
}

R/print.seroincidence.by.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#'
44
#' @description
55
#' Custom [print()] function for `seroincidence.by` objects
6-
#' (from [estimate_scr_by()])
6+
#' (from [est_seroincidence_by()])
77
#'
8-
#' @param x A list containing output of function [estimate_scr_by()].
8+
#' @param x A list containing output of function [est_seroincidence_by()].
99
#' @param ... Additional arguments affecting the summary produced.
1010
#' @inherit print.seroincidence return
1111
#' @examples
@@ -22,7 +22,7 @@
2222
#' example_noise_params_pk
2323
#'
2424
#' # estimate seroincidence
25-
#' est2 <- estimate_scr_by(
25+
#' est2 <- est_seroincidence_by(
2626
#' strata = c("catchment"),
2727
#' pop_data = xs_data,
2828
#' curve_params = curve,
@@ -51,7 +51,7 @@ print.seroincidence.by <- function(x, ...) {
5151
cat("`antigen_isos` -",
5252
"Character vector of antigen isotypes used in analysis.\n")
5353
cat("`Strata` -",
54-
"Input parameter strata of function `estimate_scr_by()`\n")
54+
"Input parameter strata of function `est_seroincidence_by()`\n")
5555
cat("\n")
5656
cat("Call the `summary()` function to obtain output results.\n")
5757
invisible(x)

R/print.summary.seroincidence.by.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' example_noise_params_pk
2424
#'
2525
#' # estimate seroincidence
26-
#' est2 <- estimate_scr_by(
26+
#' est2 <- est_seroincidence_by(
2727
#' strata = c("catchment"),
2828
#' pop_data = xs_data,
2929
#' curve_params = curve,

R/strat_ests_barplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Barplot method for `summary.seroincidence.by` objects
22
#'
33
#' @param object a `summary.seroincidence.by` object (generated by applying the
4-
#' `summary()` method to the output of [estimate_scr_by()]).
4+
#' `summary()` method to the output of [est_seroincidence_by()]).
55
#' @param yvar the name of a stratifying variable in `object`.
66
#' @param color_var
77
#' [character] the name of the fill color variable (e.g., "Country").

0 commit comments

Comments
 (0)