Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cran fixes #221

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open

Cran fixes #221

wants to merge 63 commits into from

Conversation

d-morrison
Copy link
Member

No description provided.

kristinawlai and others added 30 commits May 22, 2024 14:10
Merge branch 'CRAN-fixes' of https://github.com/UCD-SERG/serocalculator into CRAN-fixes

# Conflicts:
#	R/est.incidence.R
cleaned up `f_dev` documentation
NEWS.md Outdated
Comment on lines 3 to 15

# serocalculator (published versions)

## serocalculator 1.0.3
* Published to CRAN

## serocalculator 1.0.2
* Updated documentation and functionality based on CRAN resubmission
* Deleted get_additional_data.R as it is no longer used

# serocalculator (development versions)

## serocalculator 1.2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new updates based on CRAN submission process

#'
#' 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
#' autoplot()
#'
#' curve
#'
#'}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added missing closing bracket

autoplot.curve_params = function(
object,
antigen_isos = object$antigen_iso %>% unique(),
antigen_isos = unique(object$antigen_iso),
Copy link
Collaborator

@kristinawlai kristinawlai Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated style to avoid pipe within an argument definition

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine by me; for future reference, is this a CRAN rule, a style guide rule, or just a choice we made?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was a CRAN rule, but I haven't found it to be sure. Will update if I find it.

R/df_to_array.R Outdated Show resolved Hide resolved
Comment on lines -11 to -19
#' \dontrun{
#' # Estimate seroincidence
#' seroincidence <- est.incidence.by(...)
#'
#' # Print the seroincidence object to the console
#' print(seroincidence)
#' \donttest{
#'
#' # Or simply type (appropriate print method will be invoked automatically)
#' seroincidence
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed old, unfinished code and replace with an actual example

Comment on lines -11 to -19
#' \dontrun{
#' # Estimate seroincidence
#' seroincidence <- est.incidence.by(...)
#'
#' # Print the seroincidence object to the console
#' print(seroincidence)
#' \donttest{
#'
#' # Or simply type (appropriate print method will be invoked automatically)
#' seroincidence
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed old, unfinished code and replace with an actual example

Comment on lines -11 to -23
#' \dontrun{
#' # Estimate seroincidence
#' seroincidence <- est.incidence.by(...)
#'
#' # Calculate summary statistics for the seroincidence object
#' seroincidenceSummary <- summary(seroincidence)
#' \donttest{
#'
#' # Print the summary of seroincidence object to the console
#' print(seroincidenceSummary)
#' library(tidyverse)
#'
#' # Or simply type (appropriate print method will be invoked automatically)
#' seroincidenceSummary
#' }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed old, unfinished code and replace with an actual example

Comment on lines -9 to -15
#' @examples
#' \dontrun{
#' expected_strata <- data.frame(Species = "banana", type = "orchid")
#'
#' warn.missing.strata(iris, expected_strata, dataname = "iris")
#' }
warn.missing.strata <- function(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove example from unexported functions, per CRAN request

Copy link
Collaborator

@kristinawlai kristinawlai Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated section numbering format and corrected spelling errors

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d-morrison it doesn't look like this is an exported function but is wrapped by autoplot.curve_params.R. Should some of the text under @details be moved to autoplot.curve_params.R? Also since it is not longer exported, CRAN will likely have us remove the example.

Comment on lines -22 to -28
\examples{
\dontrun{
expected_strata <- data.frame(Species = "banana", type = "orchid")

warn.missing.strata(iris, expected_strata, dataname = "iris")
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed examples from non-exported functions per CRAN request

Comment on lines -70 to -75
\dontrun{
# estimate seroincidence
seroincidence <- est.incidence.by(...)

# calculate summary statistics for the seroincidence object
seroincidenceSummary <- summary(seroincidence)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed old incomplete example

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with newest changes and added sections for published and development versions

Comment on lines -32 to -36
#'
autoplot.seroincidence =
function(object, log_x = FALSE, ...)
{
to_return = attr(object, "ll_graph")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformatted to align with other functions

#'
autoplot.seroincidence.by = function(
#' }
autoplot.seroincidence.by <- function(
Copy link
Collaborator

@kristinawlai kristinawlai Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to "<-" to match other functions in main branch

@@ -20,14 +20,8 @@
#' * Setting the `n_curves` argument to a value smaller than the number of rows in `curve_params` will cause this function to select the first `n_curves` rows to graph.
#' * Setting `n_curves` larger than the number of rows in ` will result all curves being plotted.
Copy link
Collaborator

@kristinawlai kristinawlai Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d-morrison since plot_curve_params_one_ab() is not an exported function but is wrapped by autoplot.curve_params(), should some of the text in @details be moved there?

Comment on lines -23 to -29
#' @examples
#' library(dplyr) # loads the `%>%` operator and `dplyr::filter()`
#'
#' load_curve_params("https://osf.io/download/rtw5k/") %>%
#' dplyr::filter(antigen_iso == "HlyE_IgG") %>%
#' serocalculator:::plot_curve_params_one_ab()
#'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed example from non-exported function, per CRAN request

Comment on lines -103 to -112

# ggplot() +
# geom_line(data = serocourse.all, aes(x= t, y = res, group = iter)) +
# facet_wrap(~antigen_iso, ncol=2) +
# scale_y_log10(limits = c(0.9, 2000), breaks = c(1, 10, 100, 1000), minor_breaks = NULL) +
# theme_minimal() +
# theme(axis.line=element_line()) +
# labs(x="Days since fever onset", y="ELISA units")

# mcmc %>% ungroup() %>% slice_head(by = antigen_iso, n = 10) %>% droplevels() %>% plot_curve_params_one_ab(alpha = .4) %>% print()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed what appeared to be old code from the bottom of this file.

@kristinawlai kristinawlai marked this pull request as ready for review August 19, 2024 20:58
@kristinawlai kristinawlai self-requested a review August 19, 2024 21:00
@kristinawlai
Copy link
Collaborator

kristinawlai commented Aug 19, 2024

@d-morrison code annotation is completed and I believe I reconciled all issues between main and the CRAN branch. Since you created the PR, let me know when you think it's ready to approve.

@d-morrison
Copy link
Member Author

@kristinawlai thanks! will review asap

Copy link
Member Author

@d-morrison d-morrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still reviewing; please see comments so far

@@ -1,16 +1,14 @@
Package: serocalculator
Type: Package
Title: Estimating Infection Rates from Serological Data
Version: 1.2.0.9000
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did the version number go backwards?

Comment on lines +3 to +15
## serocalculator 1.0.3
* Published to CRAN

## serocalculator 1.0.2
* Updated documentation and functionality based on CRAN re-submission
* Deleted get_additional_data.R as it is no longer used

# serocalculator (development versions)

## serocalculator 1.0.3.9000
* Reconciled CRAN version 1.0.3 with GitHub main branch (version)

## serocalculator 1.2.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version numbers are out of order here; let's discuss how to reconcile this list

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put release version marker where it is and leave development versions as they are. Moving forward, use CRAN version numbering (from 1.2.0.9000) --> this PR will use 1.2.0.9001

@@ -10,19 +10,21 @@
#' @return a [ggplot2::ggplot()] object
#' @export
#' @examples
#' \donttest{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve the use of \donttest for now, but I have created #238 as a better long-term solution

Comment on lines -12 to +11
samples into estimates of the frequency with which seroconversions (infections)
occur in the sampled populations. Replaces the previous `seroincidence` package.
Description: Translates antibody levels measured in cross-sectional population samples into estimates of the frequency with which seroconversions (infections) occur in the sampled populations. Replaces the previous 'seroincidence' package. Methods originally published in Simonsen et al. (2009) <doi:10.1002/sim.3592> and Teunis et al. (2012) <doi:10.1002/sim.5322>, and further developed in subsequent publications by de Graaf et al. (2014) <doi:10.1016/j.epidem.2014.08.002>, Teunis et al. (2016) <doi:10.1016/j.epidem.2016.04.001>, and Teunis et al. (2020) <doi:10.1002/sim.8578>.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description is a little longer than usual (c.f. dplyr, ggplot2); in #239, we will move this information to an article, but until then, let's keep it here.

autoplot.curve_params = function(
object,
antigen_isos = object$antigen_iso %>% unique(),
antigen_isos = unique(object$antigen_iso),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine by me; for future reference, is this a CRAN rule, a style guide rule, or just a choice we made?

log_x = FALSE,
...)
{
to_return = attr(object, "ll_graph")
Copy link
Member Author

@d-morrison d-morrison Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • time to learn about unit testing; please add a test to cover this line

{
to_return = attr(object, "ll_graph")
#' }
autoplot.seroincidence <-function(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation tech debt simplifying backend code, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

merge CRAN-fixes branch with main
2 participants