Commit 0ed83171 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

cleaning up some notes

parent 698881ba
......@@ -108,7 +108,7 @@ retryGetOrPost <- function(obs_url, ...) {
obs_url <- split[[1]][1]
query <- split[[1]][2]
resp <- httr::RETRY("POST", obs_url, ..., body = query,
httr::content_type("application/x-www-form-urlencoded"), user_agent(default_ua()))
httr::content_type("application/x-www-form-urlencoded"), httr::user_agent(default_ua()))
}
return(resp)
}
\ No newline at end of file
......@@ -76,7 +76,7 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
mergedDF <- df
} else {
similarNames <- intersect(colnames(mergedDF), colnames(df))
mergedDF <- full_join(mergedDF, df, by=similarNames)
mergedDF <- dplyr::full_join(mergedDF, df, by=similarNames)
}
}
......
......@@ -239,7 +239,7 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){
if(all(c("DATE","TIME","TZCD") %in% header.names)){
varname <- "DATETIME"
varval <- as.POSIXct(fast_strptime(paste(readr.data[,"DATE"],readr.data[,"TIME"]), "%Y-%m-%d %H%M%S", tz = "UTC"))
varval <- as.POSIXct(lubridate::fast_strptime(paste(readr.data[,"DATE"],readr.data[,"TIME"]), "%Y-%m-%d %H%M%S", tz = "UTC"))
readr.data[,varname] <- varval
readr.data <- convertTZ(readr.data,"TZCD",varname,tz, flip.cols=TRUE)
}
......
......@@ -52,8 +52,8 @@ importWQP <- function(obs_url, zip=FALSE, tz="UTC"){
temp <- tempfile()
temp <- paste0(temp,".zip")
doc <- getWebServiceData(obs_url, httr::write_disk(temp))
headerInfo <- headers(doc)
doc <- unzip(temp, exdir=tempdir())
headerInfo <- httr::headers(doc)
doc <- utils::unzip(temp, exdir=tempdir())
unlink(temp)
on.exit(unlink(doc))
} else {
......
......@@ -120,7 +120,7 @@ whatWQPdata <- function(..., saveFile = tempfile()){
saveFile <- paste0(saveFile,".geojson")
}
doc <- getWebServiceData(urlCall, write_disk(saveFile))
doc <- getWebServiceData(urlCall, httr::write_disk(saveFile))
headerInfo <- attr(doc, "headerInfo")
retval <- as.data.frame(jsonlite::fromJSON(saveFile), stringsAsFactors = FALSE)
......@@ -128,7 +128,7 @@ whatWQPdata <- function(..., saveFile = tempfile()){
y <- retval[,-df_cols]
for(i in df_cols){
y <- bind_cols(y, retval[[i]])
y <- dplyr::bind_cols(y, retval[[i]])
}
y[,grep("Count$",names(y))] <- sapply(y[,grep("Count$",names(y))], as.numeric)
......
......@@ -222,7 +222,8 @@ test_that("zeroPad handles NAs", {
test_that("Dates with no days can be handled", {
testthat::skip_on_cran()
expect_error(readNWISgwl("425957088141001", startDate = "1980-01-01"))
empty_df <- readNWISgwl("425957088141001", startDate = "1980-01-01")
expect_true(nrow(empty_df) == 0)
})
context("whatWQPsamples")
......
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