-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The nested tibble from downloadDMRs() relies on the user mapping column types to unnest the dmr column:
library(dplyr)
library(echor)
df <- tibble::tibble(permit = c("TX0021474", "TX0023051", "TXG130053"))
df <- downloadDMRs(df, idColumn = permit, start_date = "01/01/2010",
end_date = "12/30/2017", parameter_code = "50050")
df %>% tidyr::unnest(dmr)
Results in the following message:
Error: Column `monitoring_location_code` can't be converted from character to numericI have to follow up with the following to unnest the data:
df %>%
mutate(n = purrr::map(dmr, ~nrow(.))) %>%
mutate(dmr = purrr::map(dmr, ~mutate(.x,
version_nmbr = as.character(version_nmbr),
monitoring_location_code = as.character(monitoring_location_code),
exceedence_pct = as.character(exceedence_pct),
rnc_detection_date = as.character(rnc_detection_date),
rnc_resolution_code = as.character(rnc_resolution_code),
rnc_resolution_date = as.character(rnc_resolution_date),
days_late = as.character(days_late),
nodi_code = as.character(nodi_code),
dmr_value_nmbr = as.numeric(dmr_value_nmbr),
dmr_value_standard_units = as.numeric(dmr_value_standard_units),
limit_value_nmbr = as.numeric(limit_value_nmbr),
limit_value_standard_units = as.numeric(limit_value_standard_units)))) %>%
tidyr::unnest(dmr)The user should not have to figure this out, but if the above code is hardcoded, it will be prone to breaking if the columns returned by the API ever change.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request