Skip to content

Commit

Permalink
Merge pull request #20 from ssi-dk/telkamp7/issue18
Browse files Browse the repository at this point in the history
Telkamp7/issue18
  • Loading branch information
telkamp7 authored Nov 6, 2023
2 parents 53fcc3d + 9d69fe2 commit 4c2129d
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 35 deletions.
9 changes: 8 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ Authors@R: c(
comment = c(ORCID = "0009-0001-5126-0190")),
person("Statens Serum Institut, SSI", role = c("cph", "fnd"))
)
Description: A powerful tool for automating the early detection of seasonal epidemic onsets in time series data. It offers the ability to estimate growth rates for consecutive time intervals and calculate the Sum of Cases (SoC) within those intervals. It is particularly useful for epidemiologists, public health professionals, and researchers seeking to identify and respond to seasonal epidemics in a timely fashion.
Description: A powerful tool for automating the early detection of seasonal epidemic
onsets in time series data. It offers the ability to estimate growth rates
for consecutive time intervals and calculate the sum of cases (SoC) within
those intervals. It is particularly useful for epidemiologists, public
health professionals, and researchers seeking to identify and respond to
seasonal epidemics in a timely fashion.
For reference on growth rate estimation, see Walling and Lipstich (2007)
<doi:10.1098/rspb.2006.3754> and Obadia et al. (2012) <doi:10.1186/1472-6947-12-147>.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
8 changes: 4 additions & 4 deletions R/aedseo.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#'
#' This function performs automated and early detection of seasonal epidemic
#' onsets (aedseo) on a time series dataset. It estimates growth rates for
#' consecutive time intervals and calculates the Sum of Cases (sum_of_cases).
#' consecutive time intervals and calculates the sum of cases (sum_of_cases).
#'
#' @param tsd A `aedseo_tsd` object containing time series data with 'time,'
#' 'observed,' and 'periodInYear.'
#' @param tsd A `aedseo_tsd` object containing time series data with 'time' and
#' 'observed.'
#' @param k An integer specifying the window size for modeling growth rates.
#' @param level The confidence level for parameter estimates, a numeric value
#' between 0 and 1.
Expand All @@ -27,7 +27,7 @@
#' interval.
#' - 'growth_warning': Logical. Is the growth rate significantly higher than
#' zero?
#' - 'sum_of_cases': The Sum of Cases within the time window.
#' - 'sum_of_cases': The sum of cases within the time window.
#' - 'sum_of_cases_warning': Logical. Does the Sum of Cases exceed the
#' disease threshold?
#' - 'seasonal_onset_alarm': Logical. Is there a seasonal onset alarm?
Expand Down
12 changes: 7 additions & 5 deletions R/autoplot.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' Create a complete ggplot appropriate to a particular data type
#' Create a complete 'ggplot' appropriate to a particular data type
#'
#' @description
#' `r lifecycle::badge("stable")`
#'
#' This function generates a complete ggplot object suitable for
#' This function generates a complete 'ggplot' object suitable for
#' visualizing time series data in an `aedseo_tsd` object. It creates a line
#' plot connecting the observations and adds points at each data point.
#'
Expand All @@ -13,11 +13,12 @@
#' ribbon
#' @param ... Additional arguments (not used).
#'
#' @return A ggplot object for visualizing the time series data.
#' @return A 'ggplot' object for visualizing the time series data.
#'
#' @aliases autoplot
#'
#' @examples
#' \dontrun{
#' # Create an example aedseo_tsd object
#' aedseo_tsd_object <- tsd(
#' observed = c(100, 120, 150, 180, 220, 270),
Expand All @@ -33,7 +34,7 @@
#' )
#'
#' # Create a ggplot visualization for the aedseo_tsd object
#' # autoplot(aedseo_tsd_object)
#' autoplot(aedseo_tsd_object)
#'
#' # Create an aedseo object
#' aedseo_object <- aedseo(
Expand All @@ -44,7 +45,8 @@
#' )
#'
#' # Create a ggplot visualization of growth rates with confidence intervals
#' # autoplot(aedseo_object, linewidth = 1, alpha = 0.2)
#' autoplot(aedseo_object, linewidth = 1, alpha = 0.2)
#' }
#' @importFrom ggplot2 autoplot
#' @rdname autoplot
#' @method autoplot aedseo_tsd
Expand Down
6 changes: 3 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#' Create a complete ggplot appropriate to a particular data type
#' Create a complete 'ggplot' appropriate to a particular data type
#'
#' @description
#' `r lifecycle::badge("stable")`
#'
#' This function generates a complete ggplot object suitable for
#' This function generates a complete 'ggplot' object suitable for
#' visualizing time series data in an `aedseo_tsd` object. It creates a line
#' plot connecting the observations and adds points at each data point.
#'
#' @param x An `aedseo_tsd` or `aedseo` object
#' @param ... Additional arguments passed to specific methods.
#'
#' @return A ggplot object for visualizing the time series data.
#' @return A 'ggplot' object for visualizing the time series data.
#'
#' @aliases plot
#'
Expand Down
3 changes: 1 addition & 2 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' `r lifecycle::badge("stable")`
#'
#' This function is used to predict future growth rates based on a model object
#' created using the AEDSEO package. It takes the model object and the number
#' created using the 'aedseo' package. It takes the model object and the number
#' of future time steps (`n_step`) for which you want to make predictions and
#' returns a prediction tibble.
#'
Expand Down Expand Up @@ -50,7 +50,6 @@
#' # Print the prediction
#' print(prediction)
#'
# TODO: #13 Turn the results into a `aedseo_predict` class. @telkmp7
predict.aedseo <- function(object, n_step = 3, ...) {
# Calculate the prediction
res <- dplyr::last(object) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' time_interval = "day"
#' )
#'
#' # Calculate AEDSEO with a 3-day window and a Poisson family model
#' # Calculate aedseo with a 3-day window and a Poisson family model
#' aedseo_results <- aedseo(
#' tsd = tsd_data,
#' k = 3,
Expand Down
32 changes: 28 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
## R CMD check results
## Test Environments

0 errors | 0 warnings | 1 note
* GitHub Actions
- macOS-latest (R release)
- windows-latest (R release)
- ubuntu-latest (R devel, R release, R oldrel-1)
* Local Windows 10, R 4.2.0

* This is a new release.
## R CMD Check Results

'SoC' is an abbreviation of sum of cases. This is explained in detail in both the README.md, but also in the relevant functions.
The package has been tested on multiple platforms and no errors or warnings were identified during the tests.

## Reviewer Feedback

Thank you for the feedback, and we've addressed the issues mentioned:

1. **References**: We've added references to the methods used in our package in the DESCRIPTION file in the required format:

2. **Commented Code in Examples**: We've removed commented code lines in examples and have made sure that the examples can be executed without issues.

## Abbreviations

* 'SoC' is an abbreviation of sum of cases. This is explained in detail in both the README.md, DESCRIPTION file, and in the relevant functions.

## Resubmission

We've addressed the feedback provided, and the package is now ready for resubmission. We appreciate your review and are looking forward to having our package included on CRAN.

Best regards,

Kasper Schou Telkamp
2 changes: 1 addition & 1 deletion man/aedseo-package.Rd

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

8 changes: 4 additions & 4 deletions man/aedseo.Rd

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

12 changes: 7 additions & 5 deletions man/autoplot.Rd

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

6 changes: 3 additions & 3 deletions man/plot.Rd

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

2 changes: 1 addition & 1 deletion man/predict.aedseo.Rd

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

2 changes: 1 addition & 1 deletion man/summary.aedseo.Rd

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

0 comments on commit 4c2129d

Please sign in to comment.