Skip to content

Commit

Permalink
Merge branch 'main' into add-user-error-message-for-missing-strata
Browse files Browse the repository at this point in the history
  • Loading branch information
d-morrison authored Sep 23, 2024
2 parents 8302735 + 82f1d11 commit 2ef8e8e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: serocalculator
Type: Package
Title: Estimating Infection Rates from Serological Data
Version: 1.3.0
Version: 1.2.0.9002
Authors@R: c(
person(given = "Peter", family = "Teunis", email = "[email protected]", role = c("aut", "cph"), comment = "Author of the method and original code."),
person(given = "Kristina", family = "Lai", email = "[email protected]", role = c("aut", "cre")),
Expand Down
25 changes: 17 additions & 8 deletions R/autoplot.curve_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@
#'
#' @inheritParams plot_curve_params_one_ab
#' @inheritDotParams plot_curve_params_one_ab
#' @param antigen_isos antigen isotypes to analyze (can be used to subset `curve_params`)
#' @param antigen_isos antigen isotypes to analyze (can subset `curve_params`)
#' @param ncol how many columns of subfigures to use in panel plot
#' @details
#' ## `rows_to_graph`
#' Note that if you directly specify `rows_to_graph` when calling this function, the row numbers are enumerated separately for each antigen isotype; in other words, for the purposes of this argument, row numbers start over at 1 for each antigen isotype. There is currently no way to specify different row numbers for different antigen isotypes; if you want to do that, you will could call [plot_curve_params_one_ab()] directly for each antigen isotype and combine the resulting panels yourself. Or you could subset `curve_params` manually, before passing it to this function, and set the `n_curves` argument to `Inf`.
#' Note that if you directly specify `rows_to_graph` when calling this function,
#' the row numbers are enumerated separately for each antigen isotype;
#' in other words, for the purposes of this argument,
#' row numbers start over at 1 for each antigen isotype. There is currently
#' no way to specify different row numbers for different antigen isotypes;
#' if you want to do that, you could call [plot_curve_params_one_ab()]
#' directly for each antigen isotype and combine the resulting panels yourself.
#' Or you could subset `curve_params` manually, before passing it to this
#' function, and set the `n_curves` argument to `Inf`.
#' @return a [ggplot2::ggplot()] object
#' @export
#' @examples
#' \donttest{
#' library(dplyr)
#' library(ggplot2)
#' library(magrittr)
#'
#' curve = load_curve_params("https://osf.io/download/rtw5k/") %>%
#' filter(antigen_iso %in% c("HlyE_IgA", "HlyE_IgG")) %>%
#' slice(1:100, .by = antigen_iso) %>% # Reduce dataset for the purposes of this example
#' slice(1:100, .by = antigen_iso) %>% # Reduce dataset for this example
#' autoplot()
#'
#' curve
#'
autoplot.curve_params = function(
#'}
autoplot.curve_params <- function(
object,
antigen_isos = object$antigen_iso %>% unique(),
antigen_isos = unique(object$antigen_iso),
ncol = min(3, length(antigen_isos)),
...) {
split_data <- object %>%
Expand All @@ -34,8 +44,7 @@ autoplot.curve_params = function(
figs <- split_data %>%
lapply(FUN = plot_curve_params_one_ab, ...)

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

Expand Down
20 changes: 15 additions & 5 deletions man/autoplot.curve_params.Rd

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

0 comments on commit 2ef8e8e

Please sign in to comment.