Commit 2e9bc44c authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Fixes #522

parent 9f0c57fb
......@@ -100,7 +100,7 @@ importWQP <- function(obs_url, zip=TRUE, tz="UTC", csv=FALSE){
ResultParticleSizeBasisText = readr::col_character(),
`ActivityDepthHeightMeasure/MeasureValue` = readr::col_number(),
`DetectionQuantitationLimitMeasure/MeasureValue` = readr::col_number(),
# ResultMeasureValue = readr::col_number(),
ResultMeasureValue = readr::col_character(),
`WellDepthMeasure/MeasureValue` = readr::col_number(),
`WellHoleDepthMeasure/MeasureValue` = readr::col_number(),
DetectionQuantitationLimitTypeName = readr::col_character(),
......@@ -117,8 +117,7 @@ importWQP <- function(obs_url, zip=TRUE, tz="UTC", csv=FALSE){
`HUCEightDigitCode` = readr::col_character(),
`ActivityEndTime/TimeZoneCode` = readr::col_character()),
quote = ifelse(csv,'\"',""),
delim = ifelse(csv,",","\t"),
guess_max = Inf))
delim = ifelse(csv,",","\t")))
if(!file.exists(obs_url)){
actualNumReturned <- nrow(retval)
......@@ -127,7 +126,19 @@ importWQP <- function(obs_url, zip=TRUE, tz="UTC", csv=FALSE){
warning("Number of rows returned not matched in header")
}
}
suppressWarnings({
val <- tryCatch(as.numeric(retval$ResultMeasureValue),
warning = function(w) w)
# we don't want to convert it to numeric if there are non-numeric chars
# they often happen after readr has decided the column type if we left it to readr
# If we leave it to the user, it will probably break a lot of code
# If we bump up readr's guess_max...the computational time becomes really really long
if(!"warning" %in% class(val)){
retval$ResultMeasureValue <- val
}
})
if(length(grep("ActivityStartTime",names(retval))) > 0){
#Time zones to characters:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment