8181# '
8282# ' An unrecognizable time type is labeled "custom".
8383# '
84- # ' @template epi_df-params
85- # ' @rdname epi_df
86- # '
87- # ' @export
84+ # ' @name epi_df
8885# ' @examples
8986# ' # Convert a `tsibble` that has county code as an extra key
9087# ' # Notice that county code should be a character string to preserve any leading zeroes
154151# ' as_epi_df(additional_metadata = list(other_keys = c("state", "pol")))
155152# '
156153# ' attr(ex3, "metadata")
154+ NULL
155+
156+ # ' Create an `epi_df` object
157+ # '
158+ # ' @rdname epi_df
159+ # ' @param geo_type DEPRECATED Has no effect. Geo value type is inferred from the
160+ # ' location column and set to "custom" if not recognized.
161+ # ' @param time_type DEPRECATED Has no effect. Time value type inferred from the time
162+ # ' column and set to "custom" if not recognized. Unpredictable behavior may result
163+ # ' if the time type is not recognized.
164+ # ' @param as_of Time value representing the time at which the given data were
165+ # ' available. For example, if `as_of` is January 31, 2022, then the `epi_df`
166+ # ' object that is created would represent the most up-to-date version of the
167+ # ' data available as of January 31, 2022. If the `as_of` argument is missing,
168+ # ' then the current day-time will be used.
169+ # ' @param additional_metadata List of additional metadata to attach to the
170+ # ' `epi_df` object. The metadata will have `geo_type`, `time_type`, and
171+ # ' `as_of` fields; named entries from the passed list will be included as
172+ # ' well. If your tibble has additional keys, be sure to specify them as a
173+ # ' character vector in the `other_keys` component of `additional_metadata`.
174+ # ' @param ... Additional arguments passed to methods.
175+ # ' @return An `epi_df` object.
176+ # '
177+ # ' @export
157178new_epi_df <- function (x = tibble :: tibble(), geo_type , time_type , as_of ,
158179 additional_metadata = list ()) {
159180 # Define metadata fields
@@ -180,22 +201,24 @@ new_epi_df <- function(x = tibble::tibble(), geo_type, time_type, as_of,
180201}
181202
182203# ' @rdname epi_df
204+ # ' @param x An `epi_df`, `data.frame`, [tibble::tibble], or [tsibble::tsibble]
205+ # ' to be converted
183206# ' @param ... used for specifying column names, as in [`dplyr::rename`]. For
184207# ' example, `geo_value = STATEFP, time_value = end_date`.
185208# ' @export
186209as_epi_df <- function (x , ... ) {
187210 UseMethod(" as_epi_df" )
188211}
189212
190- # ' @method as_epi_df epi_df
191213# ' @rdname epi_df
214+ # ' @method as_epi_df epi_df
192215# ' @export
193216as_epi_df.epi_df <- function (x , ... ) {
194217 return (x )
195218}
196219
197- # ' @method as_epi_df tbl_df
198220# ' @rdname epi_df
221+ # ' @method as_epi_df tbl_df
199222# ' @importFrom rlang .data
200223# ' @importFrom tidyselect any_of
201224# ' @importFrom cli cli_inform
0 commit comments