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
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
52f8ae1
fixes to llik and sim.cs
kristinawlai May 22, 2024
9e6ae3d
Update notes before submission to CRAN
kristinawlai May 22, 2024
afe705e
Reduce example run-time by adding \dontrun to long sections of examples.
kristinawlai May 22, 2024
012dcaf
Reduce example run-time by adding \dontrun to long sections of examples.
kristinawlai May 22, 2024
e881172
fix merge issue
kristinawlai May 22, 2024
134602d
further reduce examples
kristinawlai May 22, 2024
39bff66
Further reduce examples
kristinawlai May 22, 2024
720f528
Further reduce examples
kristinawlai May 22, 2024
ff58791
Merge branch 'CRAN-fixes' of https://github.com/UCD-SERG/serocalculat…
kristinawlai May 22, 2024
591c778
Reduce additional example
kristinawlai May 23, 2024
e45dd9a
Fix spelling in Description, reduce example runtime, update CRAN subm…
kristinawlai May 24, 2024
2c0e8c8
Add references to description as suggested by CRAN
kristinawlai Jun 5, 2024
5053f19
Remove example from unexported function as requested by CRAN
kristinawlai Jun 5, 2024
8b9f395
Remove directed quotation mars as requested by CRAN
kristinawlai Jun 5, 2024
0cb57cd
Replace ":::" with "::" as requested by CRAN + document()
kristinawlai Jun 5, 2024
1c5c491
Add on.exit() to reset timeout options as requested by CRAN
kristinawlai Jun 7, 2024
f43f498
Replace print() with message() in message to user, as reauested by CRAN
kristinawlai Jun 7, 2024
e18e3f0
remove example from unexported function
kristinawlai Jun 7, 2024
e0a5e65
Add @return to specify output in \value, as requested by CRAN
kristinawlai Jun 11, 2024
3018f56
Update version with edits based on CRAN comments
kristinawlai Jun 11, 2024
5528632
Updated CRAN comments with responses and specific changes
kristinawlai Jun 11, 2024
a0acf5d
Replace \dontrun with \donttest in examples, as requeted by CRAN
kristinawlai Jun 11, 2024
285163a
fix errors
kristinawlai Jun 11, 2024
f0c9c67
Update NEWS and additional \donttest adjustments in examples
kristinawlai Jun 12, 2024
801d719
Fixed typo
kristinawlai Jun 13, 2024
85d4e84
Update CRAN comments, make additional edits with Ezra's feedback
kristinawlai Jun 28, 2024
c859481
troubleshooting
kristinawlai Jun 29, 2024
246c52c
delete get_additional_data.R, add updated examples to summary functions
kristinawlai Jul 5, 2024
6a8c62d
cleaned up `f_dev` documentation
d-morrison Jul 5, 2024
25d2934
Merge pull request #169 from UCD-SERG/CRAN-fixes-em
kristinawlai Jul 7, 2024
1b1d460
update examples for CRAN
kristinawlai Jul 7, 2024
918a951
Update examples
kristinawlai Jul 7, 2024
ac4283c
document
kristinawlai Jul 7, 2024
9afdcb4
add back params that should have been passed from llik.R
kristinawlai Jul 8, 2024
83d50b6
fixing arguments included in \usage after checks
kristinawlai Jul 8, 2024
b96c804
remove single quotes around non-package words and change directed quo…
kristinawlai Jul 8, 2024
530b4d3
update formatting after CRAN autocheck rejection
kristinawlai Jul 8, 2024
5fce1b1
HTML fixes
kristinawlai Jul 11, 2024
cfa3ba5
updated cran submission
kristinawlai Jul 12, 2024
5b0c0be
link to new function names
d-morrison Jul 13, 2024
5b91bd4
Merge pull request #181 from UCD-SERG/CRAN-fixes-em
kristinawlai Jul 14, 2024
29cf05f
add description tag
d-morrison Jul 14, 2024
e32f000
Merge pull request #184 from UCD-SERG/CRAN-fixes-em
kristinawlai Jul 16, 2024
3cc2930
Increment version number to 1.0.3
kristinawlai Jul 16, 2024
64f38ab
Updated cran comments
kristinawlai Jul 16, 2024
4d50ded
update cran comments
kristinawlai Jul 18, 2024
709cfbe
Update cran submission
kristinawlai Jul 19, 2024
8718b80
Merge branch 'main' of https://github.com/UCD-SERG/serocalculator int…
kristinawlai Aug 13, 2024
b09b41a
Merge branch 'main' into CRAN-fixes
kristinawlai Aug 13, 2024
1fe1d0f
update documentation
kristinawlai Aug 13, 2024
0c8727c
Merge branch 'CRAN-fixes' of https://github.com/UCD-SERG/serocalculat…
kristinawlai Aug 13, 2024
0120df7
Remove mention of clean_pop_data() in exmaples + clean up EF vignette
kristinawlai Aug 13, 2024
953f68b
reformat code
kristinawlai Aug 15, 2024
f129505
continue reconciling with main
kristinawlai Aug 15, 2024
ebc0ff0
Replace with main version
kristinawlai Aug 15, 2024
6a1ce23
document changes
kristinawlai Aug 15, 2024
49f6c61
make plot_curve_params_one_ab() internal (removed @export)
kristinawlai Aug 15, 2024
24e92b5
matching style to main
kristinawlai Aug 15, 2024
dec4e25
reconcile CRAN vs main branches
kristinawlai Aug 19, 2024
5283f42
Fix spelling errors + revert changes to main branch
kristinawlai Aug 19, 2024
84b0d10
Merge branch 'main' into CRAN-fixes
kristinawlai Aug 19, 2024
30fcc8b
revert to include example + @noRd
kristinawlai Sep 19, 2024
6f036b7
Add missing space
kristinawlai Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.0.0
Date: 2024-03-12 23:48:24 UTC
SHA: 9feb9f5f1965fd7b48031b941d6570bde33f538b
Version: 1.0.3
Date: 2024-07-18 19:00:17 UTC
SHA: 4d50ded599f4b61cd0d1e784f008aef30ec6462b
6 changes: 2 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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?

Version: 1.0.3
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")),
person(given = "Chris", family = "Orwa", role = "aut"),
person(given = "Kristen", family = "Aiemjoy", email = "[email protected]", role = c("aut")),
person(given = "Douglas Ezra", family = "Morrison", email = "[email protected]", role = c("aut")))
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.
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>.
Comment on lines -12 to +11
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added in links to key citations in the format suggested by CRAN

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.

Depends: R (>= 4.1.0)
License: GPL-3
Imports:
Expand Down
4 changes: 1 addition & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ export(check_pop_data)
export(est.incidence)
export(est.incidence.by)
export(f_dev)
export(f_dev0)
export(fdev)
export(getAdditionalData)
export(get_additional_data)
d-morrison marked this conversation as resolved.
Show resolved Hide resolved
export(graph.curve.params)
export(graph.loglik)
export(llik)
export(load_curve_params)
export(load_noise_params)
export(load_pop_data)
export(log_likelihood)
export(plot_curve_params_one_ab)
export(sim.cs)
export(sim.cs.multi)
importFrom(Rcpp,sourceCpp)
Expand Down
19 changes: 15 additions & 4 deletions NEWS.md
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

Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# serocalculator (development version)

# serocalculator 1.2.0
# 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
* Added `test-summary.pop_data` test

* Modified `test-est.incidence` test
Expand All @@ -10,7 +20,7 @@
* Added `verbose` option for `check_pop_data()`, changing default behavior
to avoid printing an OK message.

# serocalculator 1.1.0
## serocalculator 1.1.0

* Renamed `llik()` to `log_likelihood()`

Expand Down Expand Up @@ -46,10 +56,11 @@ to avoid printing an OK message.

* Replaced column name comparison on `check_pop_data()` to use attribute name on `pop_data` class

# serocalculator 1.0.1
## serocalculator 1.0.1

* added `n_points` argument to `plot_curve_params_one_ab()`
* Added `type = "age-scatter"` option for `autoplot.pop_data()`
* Updated documentation for sim.cs and log-likelihood

## serocalculator 1.0.0

Expand Down
6 changes: 4 additions & 2 deletions R/autoplot.curve_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

#' 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
#' 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.

ncol = min(3, length(antigen_isos)),
...) {
split_data <- object %>%
Expand Down
2 changes: 2 additions & 0 deletions R/autoplot.pop_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' @return a [ggplot2::ggplot] object
#'
#' @examples
#' \donttest{
#' library(dplyr)
#' library(ggplot2)
#'
Expand All @@ -24,6 +25,7 @@
#'
#' xs_data %>% autoplot(strata = "Country", type = "density")
#' xs_data %>% autoplot(strata = "Country", type = "age-scatter")
#' }
#' @export
autoplot.pop_data <- function(
object,
Expand Down
4 changes: 2 additions & 2 deletions R/autoplot.seroincidence.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @return a [ggplot2::ggplot()]
#' @export
#' @examples
#'
#'\donttest{
#' library(dplyr)
#' library(ggplot2)
#'
Expand All @@ -29,7 +29,7 @@
#'
#' # Plot the log-likelihood curve
#' autoplot(est1)
#'
#' }
autoplot.seroincidence =
function(object, log_x = FALSE, ...)
{
Expand Down
5 changes: 3 additions & 2 deletions R/autoplot.seroincidence.by.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#'
#' library(dplyr)
#' library(ggplot2)
#'
#'\donttest{
#' xs_data <- "https://osf.io/download//n6cp3/" %>%
#' load_pop_data()
#'
Expand All @@ -20,6 +20,7 @@
#'
#' noise <- load_noise_params("https://osf.io/download//hqy4v/")
#'
#'
#' est2 <- est.incidence.by(
#' strata = c("catchment"),
#' pop_data = xs_data %>% filter(Country == "Pakistan"),
Expand All @@ -32,7 +33,7 @@
#'
#' # Plot the log-likelihood curve
#' autoplot(est2)
#'
#' }
autoplot.seroincidence.by = function(
object,
ncol = min(3, length(object)),
Expand Down
7 changes: 4 additions & 3 deletions R/autoplot.summary.seroincidence.by.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
#' @return a [ggplot2::ggplot()] object
#' @export
#' @examples
#'
#'\donttest{
#' library(dplyr)
#' library(ggplot2)
#'
#'
#' xs_data <- load_pop_data("https://osf.io/download//n6cp3/")
#'
#' curve <- load_curve_params("https://osf.io/download/rtw5k/") %>%
Expand All @@ -34,8 +35,8 @@
#' est2sum <- summary(est2)
#'
#' autoplot(est2sum, "catchment")
#'
autoplot.summary.seroincidence.by <- function(
#' }
autoplot.summary.seroincidence.by = function(
object,
xvar,
alpha = .7,
Expand Down
2 changes: 1 addition & 1 deletion R/build_likelihood_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# add terms, e.g. for other antibodies
for (cur_antigen in antigen_isos)
{
res <- res +
res = res +

Check warning on line 13 in R/build_likelihood_function.R

View check run for this annotation

Codecov / codecov/patch

R/build_likelihood_function.R#L13

Added line #L13 was not covered by tests
f_dev(
lambda = lambda,
csdata = cross_sectional_data[[cur_antigen]],
Expand Down
13 changes: 0 additions & 13 deletions R/df_to_array.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ df.to.array <- function(
#' @param value_var_name a [character()] variable containing a variable name from `df` which contains the values for the intended array.
#' @return an [array()] with dimensions defined by the variables in `df` listed in `dim_var_names`
#'
#' @examples
#' library(dplyr)
#' library(tidyr)
#'
#' df <- iris %>%
#' tidyr::pivot_longer(
#' names_to = "parameter",
#' cols = c("Sepal.Length", "Sepal.Width", "Petal.Width", "Petal.Length")
#' ) %>%
#' mutate(parameter = factor(parameter, levels = unique(parameter)))
#' arr <- df %>% serocalculator:::df.to.array(dim_var_names = c("parameter", "Species"))
#' ftable(arr[,,1:5])
#' @noRd
kristinawlai marked this conversation as resolved.
Show resolved Hide resolved
df_to_array <- function(
df,
dim_var_names,
Expand Down
4 changes: 3 additions & 1 deletion R/est.incidence.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @returns a `"seroincidence"` object, which is a [stats::nlm()] fit object with extra meta-data attributes `lambda_start`, `antigen_isos`, and `ll_graph`
#' @export
#' @examples
#'
#'\donttest{
#' library(dplyr)
#'
#' xs_data <- load_pop_data("https://osf.io/download//n6cp3/")
Expand All @@ -25,6 +25,7 @@
#'
#' noise <- load_noise_params("https://osf.io/download//hqy4v/")
#'
#'
#' est1 <- est.incidence(
#' pop_data = xs_data %>% filter(Country == "Pakistan"),
#' curve_params = curves,
Expand All @@ -34,6 +35,7 @@
#' )
#'
#' summary(est1)
#' }
est.incidence <- function(
pop_data,
curve_params,
Expand Down
5 changes: 3 additions & 2 deletions R/est.incidence.by.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#'
#' @export
#' @examples
#'
#'\donttest{
#' library(dplyr)
#'
#' xs_data <- load_pop_data("https://osf.io/download//n6cp3/")
Expand All @@ -43,6 +43,7 @@
#'
#' noise <- load_noise_params("https://osf.io/download//hqy4v/")
#'
#'
#' est2 <- est.incidence.by(
#' strata = c("catchment"),
#' pop_data = xs_data %>% filter(Country == "Pakistan"),
Expand All @@ -54,7 +55,7 @@
#' )
#'
#' summary(est2)
#'
#' }
est.incidence.by <- function(
pop_data,
curve_params,
Expand Down
74 changes: 37 additions & 37 deletions R/f_dev.r
kristinawlai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,43 @@ fdev <- function(lambda, csdata, lnpars, cond)
#' cond = cur_noise_params
#' )
f_dev0 <- function(
lambda,
csdata,
lnpars,
cond) {
res <- 0
lambda <- as.double(lambda)
y <- as.double(get_value(csdata))
a <- as.double(get_age(csdata))
nsubj <- as.integer(nrow(csdata))
y1 <- as.double(lnpars$y1)
alpha <- as.double(lnpars$alpha)
d <- as.double(lnpars$d)
nmc <- as.integer(length(y1))
step <- as.double(max(y1) / 100) # hack for numerical integrations
nu <- as.double(cond$nu)
eps <- as.double(cond$eps)
y.low <- as.double(cond$y.low)
y.high <- as.double(cond$y.high)
llpp <- .C(
"negloglik",
res = as.double(res),
lambda = lambda,
y = y,
a = a,
nsubj = nsubj,
nu = nu,
eps = eps,
step = step,
y.low = y.low,
y.high = y.high,
y1 = y1,
alpha = alpha,
d = d,
nmc = nmc
)
return(llpp$res)
}
lambda,
csdata,
lnpars,
cond) {
res <- 0
lambda <- as.double(lambda)
y <- as.double(get_value(csdata))
a <- as.double(get_age(csdata))
nsubj <- as.integer(nrow(csdata))
y1 <- as.double(lnpars$y1)
alpha <- as.double(lnpars$alpha)
d <- as.double(lnpars$d)
nmc <- as.integer(length(y1))
step <- as.double(max(y1) / 100) # hack for numerical integrations
nu <- as.double(cond$nu)
eps <- as.double(cond$eps)
y.low <- as.double(cond$y.low)
y.high <- as.double(cond$y.high)
llpp <- .C(
"negloglik",
res = as.double(res),
lambda = lambda,
y = y,
a = a,
nsubj = nsubj,
nu = nu,
eps = eps,
step = step,
y.low = y.low,
y.high = y.high,
y1 = y1,
alpha = alpha,
d = d,
nmc = nmc
)
return(llpp$res)
}

#' @title Calculate negative log-likelihood (deviance) for one antigen:isotype pair and several values of incidence
#'
Expand Down
Loading
Loading