Skip to content

fix+doc: ?epi_df works again #502

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

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 29 additions & 6 deletions R/epi_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@
#'
#' An unrecognizable time type is labeled "custom".
#'
#' @template epi_df-params
#' @rdname epi_df
#'
#' @export
#' @name epi_df
#' @examples
#' # Convert a `tsibble` that has county code as an extra key
#' # Notice that county code should be a character string to preserve any leading zeroes
Expand Down Expand Up @@ -154,6 +151,30 @@
#' as_epi_df(additional_metadata = list(other_keys = c("state", "pol")))
#'
#' attr(ex3, "metadata")
NULL

#' Create an `epi_df` object
#'
#' @rdname epi_df
#' @param geo_type DEPRECATED Has no effect. Geo value type is inferred from the
#' location column and set to "custom" if not recognized.
#' @param time_type DEPRECATED Has no effect. Time value type inferred from the time
#' column and set to "custom" if not recognized. Unpredictable behavior may result
#' if the time type is not recognized.
#' @param as_of Time value representing the time at which the given data were
#' available. For example, if `as_of` is January 31, 2022, then the `epi_df`
#' object that is created would represent the most up-to-date version of the
#' data available as of January 31, 2022. If the `as_of` argument is missing,
#' then the current day-time will be used.
#' @param additional_metadata List of additional metadata to attach to the
#' `epi_df` object. The metadata will have `geo_type`, `time_type`, and
#' `as_of` fields; named entries from the passed list will be included as
#' well. If your tibble has additional keys, be sure to specify them as a
#' character vector in the `other_keys` component of `additional_metadata`.
#' @param ... Additional arguments passed to methods.
#' @return An `epi_df` object.
#'
#' @export
new_epi_df <- function(x = tibble::tibble(), geo_type, time_type, as_of,
additional_metadata = list()) {
# Define metadata fields
Expand All @@ -180,22 +201,24 @@ new_epi_df <- function(x = tibble::tibble(), geo_type, time_type, as_of,
}

#' @rdname epi_df
#' @param x An `epi_df`, `data.frame`, [tibble::tibble], or [tsibble::tsibble]
#' to be converted
#' @param ... used for specifying column names, as in [`dplyr::rename`]. For
#' example, `geo_value = STATEFP, time_value = end_date`.
#' @export
as_epi_df <- function(x, ...) {
UseMethod("as_epi_df")
}

#' @method as_epi_df epi_df
#' @rdname epi_df
#' @method as_epi_df epi_df
#' @export
as_epi_df.epi_df <- function(x, ...) {
return(x)
}

#' @method as_epi_df tbl_df
#' @rdname epi_df
#' @method as_epi_df tbl_df
#' @importFrom rlang .data
#' @importFrom tidyselect any_of
#' @importFrom cli cli_inform
Expand Down
18 changes: 0 additions & 18 deletions man-roxygen/epi_df-params.R

This file was deleted.

6 changes: 4 additions & 2 deletions man/epi_df.Rd

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

Loading