cmu-delphi / epidatr

Delphi Epidata API R Client
https://cmu-delphi.github.io/epidatr/
Other
1 stars 5 forks source link

`covid_hosp_timeseries` error when parsing NA values #243

Closed dshemetov closed 7 months ago

dshemetov commented 7 months ago
library(epidatr)

# Bug
dates <- epirange("2020-11-01", "2020-12-01")
pub_covid_hosp_state_timeseries(
  states = "ca",
  dates = dates,
  # fetch_args = fetch_args_list(dry_run = TRUE)
)
# Error in if (any(value != round(value))) { : 
#   missing value where TRUE/FALSE needed
# Timing stopped at: 0.024 0.001 0.15

The API response is here, which looks fine.

UPDATE: found the offending column (another column geocoded_state was also all NA, but its type is text, so it's fine), it's probably a general problem with int columns with NAs

Browse[2]> value
 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[23] NA NA NA NA NA NA NA NA NA

Browse[2]> info

── <EpidataFieldInfo> object: ────────────────────────────────────────
name: on_hand_supply_therapeutic_a_casirivimab_imdevimab_courses
type: int
description:
categories:

Browse[2]> c
Error in if (any(value != round(value))) { : 
  missing value where TRUE/FALSE needed
Timing stopped at: 5.347 0.254 220.9