Commit b4d1dcff authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

I think would work with both earlier and later readr's

parent 61d498a3
......@@ -114,22 +114,21 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){
data.rows <- total.rows - meta.rows - 2
if(data.rows > 0){
args_list <- list(file = f,
delim = "\t",
skip = meta.rows + 2,
col_names = FALSE)
if(packageVersion("readr") > 1.9){
args_list[["show_col_types"]] <- FALSE
}
if(convertType){
readr.data <- readr::read_delim(file = f, delim = "\t",
skip = meta.rows + 2,
guess_max = data.rows,
show_col_types = FALSE,
col_names = FALSE)
args_list[["guess_max"]] <- data.rows
} else {
readr.data <- readr::read_delim(file = f, delim = "\t",
skip = meta.rows + 2,
col_types = readr::cols(.default = "c"),
show_col_types = FALSE,
col_names = FALSE)
args_list[["col_types"]] <- readr::cols(.default = "c")
}
readr.data <- do.call(readr::read_delim, args = args_list)
readr.problems <- readr::problems(readr.data)
readr.data <- as.data.frame(readr.data)
......
......@@ -4,10 +4,13 @@
\alias{whatNWISdata}
\title{USGS data availability}
\usage{
whatNWISdata(...)
whatNWISdata(..., convertType = TRUE)
}
\arguments{
\item{\dots}{see \url{https://waterservices.usgs.gov/rest/Site-Service.html} for a complete list of options. A list of arguments can also be supplied.}
\item{convertType}{logical, defaults to \code{TRUE}. If \code{TRUE}, the function will convert the data to dates, datetimes,
numerics based on a standard algorithm. If false, everything is returned as a character}
}
\value{
A data frame with the following columns:
......
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