Skip to content

Commit ed6f249

Browse files
authored
Merge pull request #306 from cmu-delphi/defaultPrinting
Fixing #300 by giving default values for fields
2 parents 0026856 + 98fab61 commit ed6f249

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

.github/workflows/test-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: Upload test results
4949
if: failure()
50-
uses: actions/upload-artifact@v3
50+
uses: actions/upload-artifact@v4
5151
with:
5252
name: coverage-test-failures
5353
path: ${{ runner.temp }}/package

.lintr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
linters: linters_with_defaults(
22
line_length_linter(120),
3-
cyclocomp_linter = NULL,
4-
object_length_linter(length = 40L)
3+
object_length_linter(length = 40L),
4+
return_linter = NULL
55
)
66
exclusions: list(
77
"renv",

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: epidatr
33
Title: Client for Delphi's 'Epidata' API
4-
Version: 1.2.0
4+
Version: 1.2.1
55
Authors@R: c(
66
person("Logan", "Brooks", , "[email protected]", role = "aut"),
77
person("Dmitry", "Shemetov", , "[email protected]", role = "aut"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# epidatr 1.2.1
2+
## Patches
3+
- Fix so that `covidcast_epidata()` will still print if fields are missing.
4+
15
# epidatr 1.2.0
26

37
## Changes

R/covidcast.R

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ parse_source <- function(source, base_url) {
6969
#' @export
7070
as_tibble.covidcast_data_signal_list <- function(x, ...) {
7171
tib <- list()
72-
tib$source <- unname(map_chr(x, "source"))
73-
tib$signal <- unname(map_chr(x, "signal"))
74-
tib$name <- unname(map_chr(x, "name"))
75-
tib$active <- unname(map_lgl(x, "active"))
76-
tib$short_description <- unname(map_chr(x, "short_description"))
77-
tib$description <- unname(map_chr(x, "description"))
78-
tib$time_type <- unname(map_chr(x, "time_type"))
79-
tib$time_label <- unname(map_chr(x, "time_label"))
80-
tib$value_label <- unname(map_chr(x, "value_label"))
81-
tib$format <- unname(map_chr(x, "format"))
82-
tib$category <- unname(map_chr(x, "category"))
83-
tib$high_values_are <- unname(map_chr(x, "high_values_are"))
72+
chr_fields <- c(
73+
"source", "signal", "name", "short_description",
74+
"description", "time_type", "time_label", "value_label",
75+
"format", "category", "high_values_are"
76+
)
77+
for (field in chr_fields) {
78+
tib[[field]] <- unname(map_chr(x, field, .default = ""))
79+
}
80+
lgl_fields <- c("active")
81+
for (field in lgl_fields) {
82+
tib[[field]] <- unname(map_lgl(x, field, .default = ""))
83+
}
8484
as_tibble(tib)
8585
}
8686

@@ -184,11 +184,10 @@ covidcast_epidata <- function(base_url = global_base_url, timeout_seconds = 30)
184184
#' @export
185185
as_tibble.covidcast_data_source_list <- function(x, ...) {
186186
tib <- list()
187-
tib$source <- unname(map_chr(x, "source"))
188-
tib$name <- unname(map_chr(x, "name"))
189-
tib$description <- unname(map_chr(x, "description"))
190-
tib$reference_signal <- unname(map_chr(x, "reference_signal"))
191-
tib$license <- unname(map_chr(x, "license"))
187+
fields <- c("source", "name", "description", "reference_signal", "license")
188+
for (field in fields) {
189+
tib[[field]] <- unname(map_chr(x, field, .default = ""))
190+
}
192191
as_tibble(tib)
193192
}
194193

man/covidcast_epidata.Rd

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)