81
81
# '
82
82
# ' An unrecognizable time type is labeled "custom".
83
83
# '
84
- # ' @template epi_df-params
85
- # ' @rdname epi_df
86
- # '
87
- # ' @export
84
+ # ' @name epi_df
88
85
# ' @examples
89
86
# ' # Convert a `tsibble` that has county code as an extra key
90
87
# ' # Notice that county code should be a character string to preserve any leading zeroes
154
151
# ' as_epi_df(additional_metadata = list(other_keys = c("state", "pol")))
155
152
# '
156
153
# ' 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
157
178
new_epi_df <- function (x = tibble :: tibble(), geo_type , time_type , as_of ,
158
179
additional_metadata = list ()) {
159
180
# Define metadata fields
@@ -180,22 +201,24 @@ new_epi_df <- function(x = tibble::tibble(), geo_type, time_type, as_of,
180
201
}
181
202
182
203
# ' @rdname epi_df
204
+ # ' @param x An `epi_df`, `data.frame`, [tibble::tibble], or [tsibble::tsibble]
205
+ # ' to be converted
183
206
# ' @param ... used for specifying column names, as in [`dplyr::rename`]. For
184
207
# ' example, `geo_value = STATEFP, time_value = end_date`.
185
208
# ' @export
186
209
as_epi_df <- function (x , ... ) {
187
210
UseMethod(" as_epi_df" )
188
211
}
189
212
190
- # ' @method as_epi_df epi_df
191
213
# ' @rdname epi_df
214
+ # ' @method as_epi_df epi_df
192
215
# ' @export
193
216
as_epi_df.epi_df <- function (x , ... ) {
194
217
return (x )
195
218
}
196
219
197
- # ' @method as_epi_df tbl_df
198
220
# ' @rdname epi_df
221
+ # ' @method as_epi_df tbl_df
199
222
# ' @importFrom rlang .data
200
223
# ' @importFrom tidyselect any_of
201
224
# ' @importFrom cli cli_inform
0 commit comments