@@ -2163,13 +2163,18 @@ pvt_twitter <- function(
21632163# '
21642164# ' @examples
21652165# ' \dontrun{
2166- # ' pub_wiki(articles = "avian_influenza", epiweeks = epirange(201501, 201601))
2166+ # ' pub_wiki(
2167+ # ' articles = "avian_influenza",
2168+ # ' time_type = "week",
2169+ # ' time_values = epirange(201501, 201601)
2170+ # ' )
21672171# ' }
21682172# ' @param articles character. Articles to fetch.
21692173# ' @param ... not used for values, forces later arguments to bind by name
2170- # ' @param dates [`timeset`]. Dates to fetch. Mutually exclusive with `epiweeks`.
2171- # ' @param epiweeks [`timeset`]. Epiweeks to fetch. Mutually exclusive with
2172- # ' `dates`.
2174+ # ' @param time_type string. The temporal resolution of the data (either "day" or
2175+ # ' "week", depending on signal).
2176+ # ' @param time_values [`timeset`]. Dates or epiweeks to fetch. Defaults to all
2177+ # ' ("*") dates.
21732178# ' @param language string. Language to fetch.
21742179# ' @param hours integer. Optionally, the hours to fetch.
21752180# ' @param fetch_args [`fetch_args`]. Additional arguments to pass to `fetch()`.
@@ -2179,24 +2184,34 @@ pvt_twitter <- function(
21792184pub_wiki <- function (
21802185 articles ,
21812186 ... ,
2182- dates = NULL ,
2183- epiweeks = NULL ,
2187+ time_type = c( " day " , " week " ) ,
2188+ time_values = " * " ,
21842189 hours = NULL ,
21852190 language = " en" ,
21862191 fetch_args = fetch_args_list()) {
21872192 rlang :: check_dots_empty()
21882193
2194+ time_type <- match.arg(time_type )
2195+ if (time_type == " day" ) {
2196+ dates <- time_values
2197+ epiweeks <- NULL
2198+ dates <- get_wildcard_equivalent_dates(dates , " day" )
2199+ } else {
2200+ dates <- NULL
2201+ epiweeks <- time_values
2202+ epiweeks <- get_wildcard_equivalent_dates(epiweeks , " week" )
2203+ }
2204+
21892205 assert_character_param(" articles" , articles )
2206+ assert_character_param(" time_type" , time_type , len = 1 )
2207+ assert_timeset_param(" time_values" , time_values )
21902208 assert_timeset_param(" dates" , dates , required = FALSE )
21912209 assert_timeset_param(" epiweeks" , epiweeks , required = FALSE )
21922210 assert_integerish_param(" hours" , hours , required = FALSE )
21932211 assert_character_param(" language" , language , len = 1 , required = FALSE )
21942212 dates <- parse_timeset_input(dates )
21952213 epiweeks <- parse_timeset_input(epiweeks )
21962214
2197- if (! xor(is.null(dates ), is.null(epiweeks ))) {
2198- stop(" exactly one of `dates` and `epiweeks` is required" )
2199- }
22002215 time_field <- if (! is.null(dates )) {
22012216 create_epidata_field_info(" date" , " date" )
22022217 } else {
0 commit comments