Skip to content
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ root = true

# Change these settings to your own preference
indent_style = space
indent_size = 4
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
Expand Down
15 changes: 8 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: epidatr
Type: Package
Title: Client for Delphi's Epidata API
Version: 1.0.0
Version: 0.5.0
Authors@R: as.person(c(
"Jacob Bien <[email protected]> [aut]",
"Logan Brooks <[email protected]> [aut]",
Expand All @@ -20,15 +20,16 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Imports:
httr,
jsonlite,
readr,
MMWRweek,
rlang
cli,
httr,
jsonlite,
readr,
MMWRweek,
rlang,
magrittr
RoxygenNote: 7.2.3
Suggests:
knitr,
magrittr,
rmarkdown,
testthat
VignetteBuilder: knitr
Expand Down
10 changes: 9 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Generated by roxygen2: do not edit by hand

S3method(as.data.frame,covidcast_data_signal_list)
S3method(as.data.frame,covidcast_data_source_list)
S3method(print,covidcast_data_signal)
S3method(print,covidcast_data_source)
S3method(print,covidcast_epidata)
S3method(print,epidata_call)
S3method(print,epidata_csv)
export("%>%")
export(covid_hosp_facility)
export(covid_hosp_facility_lookup)
export(covid_hosp_state_timeseries)
Expand All @@ -12,7 +20,6 @@ export(ecdc_ili)
export(epirange)
export(fetch_classic)
export(fetch_csv)
export(fetch_df)
export(fetch_json)
export(fetch_tbl)
export(flusurv)
Expand Down Expand Up @@ -46,5 +53,6 @@ importFrom(httr,http_error)
importFrom(httr,modify_url)
importFrom(httr,stop_for_status)
importFrom(jsonlite,fromJSON)
importFrom(magrittr,"%>%")
importFrom(readr,read_csv)
importFrom(rlang,abort)
2 changes: 1 addition & 1 deletion R/constants.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version <- "1.0.0"
http_headers <- httr::add_headers("User-Agent" = paste0("epidatr/", version))
http_headers <- httr::add_headers("User-Agent" = paste0("epidatr/", version), "Accept-Encoding" = "gzip")
global_base_url <- "https://delphi.cmu.edu/epidata/"
7 changes: 7 additions & 0 deletions R/covidcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ parse_signal <- function(signal, base_url) {
r
}

#' @export
print.covidcast_data_signal <- function(signal, ...) {
print(signal$name)
print(signal$key)
Expand All @@ -46,6 +47,8 @@ parse_source <- function(source, base_url) {
r
}

#' @method as.data.frame covidcast_data_signal_list
#' @export
as.data.frame.covidcast_data_signal_list <- function(signals, ...) {
as.data.frame(do.call(rbind, lapply(signals, function(x) {
sub <- x[c(
Expand Down Expand Up @@ -74,6 +77,7 @@ as.data.frame.covidcast_data_signal_list <- function(signals, ...) {
}), ...)
}

#' @export
print.covidcast_data_source <- function(source, ...) {
print(source$name, ...)
print(source$source, ...)
Expand Down Expand Up @@ -127,6 +131,8 @@ covidcast_epidata <- function(base_url = global_base_url) {
)
}

#' @method as.data.frame covidcast_data_source_list
#' @export
as.data.frame.covidcast_data_source_list <- function(sources, ...) {
as.data.frame(do.call(rbind, lapply(sources, function(x) {
sub <- x[c(
Expand All @@ -141,6 +147,7 @@ as.data.frame.covidcast_data_source_list <- function(sources, ...) {
}), ...)
}

#' @export
print.covidcast_epidata <- function(epidata, ...) {
print("COVIDcast Epidata Fetcher")
print("Sources:")
Expand Down
Loading