Skip to content

Commit ed4b7b6

Browse files
committed
Update Docs
1 parent 5144da2 commit ed4b7b6

14 files changed

+59
-42
lines changed

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Description: Create epicurves or epigantt charts in 'ggplot2'. Prepare
1212
(A) seasonal date alignment for respiratory disease surveillance,
1313
(B) date-based case binning based on specified time intervals like
1414
isoweek, epiweek, month and more, (C) automated detection and marking
15-
of the new year based on the date/datetime axis of the 'ggplot2'.
15+
of the new year based on the date/datetime axis of the 'ggplot2'.
16+
An introduction on how to use epicurves can be found on the US CDC website
17+
(2012, <https://www.cdc.gov/training/quicklearns/epimode/index.html>).
1618
License: GPL (>= 3)
1719
URL: https://ggsurveillance.biostats.dev,
1820
https://github.com/biostats-dev/ggsurveillance

R/align_dates_seasonal.R

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ align_dates_seasonal <- function(
144144

145145
#' @rdname align_dates_seasonal
146146
#' @importFrom tsibble as_tsibble fill_gaps
147+
#' @import dplyr
148+
#' @import lubridate
149+
#' @import ISOweek
150+
#' @import rlang
151+
#' @importFrom tidyselect eval_select
152+
#' @importFrom stringr str_pad
153+
#' @importFrom utils tail
147154
#' @export
148155

149156
align_and_bin_dates_seasonal <- function(
@@ -196,14 +203,6 @@ align_and_bin_dates_seasonal <- function(
196203
)
197204
}
198205

199-
#' @import dplyr
200-
#' @import lubridate
201-
#' @import ISOweek
202-
#' @import rlang
203-
#' @importFrom tidyselect eval_select
204-
#' @importFrom stringr str_pad
205-
#' @importFrom utils tail
206-
207206
.is_current_season <- function(season) (season == (sort(season) |> utils::tail(n = 1)))
208207

209208
.check_align_df <- function(df, dates_from) {
@@ -321,7 +320,6 @@ align_and_bin_dates_seasonal <- function(
321320
)
322321
}
323322

324-
325323
.coerce_to_date <- function(dates) {
326324
date_iso_pattern <- "^\\d{4}-\\d{2}-\\d{2}$"
327325
year_month_pattern <- "^\\d{4}-\\d{2}$"

R/geom_epicurve.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#' @details
4040
#' Epi Curves are a public health tool for outbreak investigation. For more details see the references.
4141
#'
42-
#' @return A ggplot2 layer that can be added to a plot
42+
#' @return A `ggplot2` geom layer that can be added to a plot
4343
#' @seealso [scale_y_cases_5er()], [geom_vline_year()]
4444
#' @export
4545
#'
@@ -65,6 +65,7 @@
6565
#' labs(title = "Epicurve Example") +
6666
#' scale_y_cases_5er() +
6767
#' scale_x_date(date_breaks = "4 weeks", date_labels = "W%V'%g") + # Correct ISOWeek labels week'year
68+
#' coord_equal(ratio = 7) + # Use coord_equal for square boxes. 'ratio' are the days per week.
6869
#' theme_bw()
6970
#'
7071
#' # Categorical epicurve

R/geom_epigantt.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#' `xmin` and `xmax`. Each case draws a single graphical object.
55
#'
66
#' @inheritParams ggplot2::geom_linerange
7+
#' @return A `ggplot2` geom layer that can be added to a plot
78
#'
89
#' @export
910
geom_epigantt <- function(mapping = NULL, data = NULL,

R/reexport-tidyr.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#'
1313
#' @inheritParams tidyr::uncount
1414
#'
15-
#' @return A data frame with rows duplicated according to weights.
15+
#' @return A `data.frame` with rows duplicated according to weights.
1616
#' @examples
1717
#' df <- data.frame(x = c("a", "b"), n = c(2, 3))
1818
#' df |> uncount(n)

R/scale_cases_5er.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@
1313
#' or [ggplot2::expansion()] to modify
1414
#' @param ... Additional arguments passed on to [base::pretty()].
1515
#'
16-
#' @return A **ggplot2** scale object that can be added to a plot.
16+
#' @return A `ggplot2` scale object that can be added to a plot.
1717
#' @seealso [geom_epicurve()], [ggplot2::scale_y_continuous()], [base::pretty()]
1818
#'
1919
#' @examples
20-
#' \dontrun{
2120
#' library(ggplot2)
2221
#'
2322
#' data <- data.frame(date = as.Date("2024-01-01") + 0:30)
2423
#' ggplot(data, aes(x = date)) +
2524
#' geom_epicurve(date_resolution = "week") +
2625
#' scale_y_cases_5er()
27-
#' }
2826
#' @importFrom scales censor
2927
#' @export
3028

data-raw/figures.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ ggplot(df_flu_aligned, aes(x = date_aligned, y = Incidence)) +
4747
theme(legend.position = c(0.2, 0.8))
4848

4949
ggsave("man/figures/seasonal_plot_readme.png", width = 6, height = 3.5, dpi = 600)
50-

man/geom_epicurve.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_epigantt.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/scale_y_cases_5er.Rd

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)