diff --git a/R/fetchSCAN.R b/R/fetchSCAN.R index 8aa62b27..b47f926b 100644 --- a/R/fetchSCAN.R +++ b/R/fetchSCAN.R @@ -73,10 +73,10 @@ #' #' @param site.code a vector of site codes. If `NULL` `SCAN_site_metadata()` returns metadata for all SCAN sites. #' @param year a vector of years -#' @param report report name, single value only +#' @param report report name, single value only; default `'SCAN'`, other example options include individual sensor codes, e.g. `'SMS'` for Soil Moisture Storage, `'TEMP'` for temperature #' @param timeseries either `'Daily'` or `'Hourly'` #' @param ... additional arguments. May include `intervalType`, `format`, `sitenum`, `interval`, `year`, `month`. Presence of additional arguments bypasses default batching functionality provided in the function and submits a 'raw' request to the API form. -#' @return a \code{data.frame} object; `NULL` on bad request. +#' @return a `list` of `data.frame` objects, where each element name is a sensor type, plus a `metadata` table; different `report` types change the types of sensor data returned. `SCAN_sensor_metadata()` and `SCAN_site_metadata()` return a `data.frame`. `NULL` on bad request. #' @author D.E. Beaudette, A.G. Brown #' @keywords manip #' @examples @@ -277,7 +277,7 @@ fetchSCAN <- function(site.code = NULL, year = NULL, report = 'SCAN', timeseries # Time ranges from "00:00" to "23:00" [24 hourly readings] # set Time to 12:00 (middle of day) for daily data - if (all(res$Time == "")) { + if (is.null(res$Time) || all(res$Time == "")) { res$Time <- "12:00" } diff --git a/man/fetchSCAN.Rd b/man/fetchSCAN.Rd index 98ab9f5e..60822097 100644 --- a/man/fetchSCAN.Rd +++ b/man/fetchSCAN.Rd @@ -23,14 +23,14 @@ SCAN_site_metadata(site.code = NULL) \item{year}{a vector of years} -\item{report}{report name, single value only} +\item{report}{report name, single value only; default \code{'SCAN'}, other example options include individual sensor codes, e.g. \code{'SMS'} for Soil Moisture Storage, \code{'TEMP'} for temperature} \item{timeseries}{either \code{'Daily'} or \code{'Hourly'}} \item{...}{additional arguments. May include \code{intervalType}, \code{format}, \code{sitenum}, \code{interval}, \code{year}, \code{month}. Presence of additional arguments bypasses default batching functionality provided in the function and submits a 'raw' request to the API form.} } \value{ -a \code{data.frame} object; \code{NULL} on bad request. +a \code{list} of \code{data.frame} objects, where each element name is a sensor type, plus a \code{metadata} table; different \code{report} types change the types of sensor data returned. \code{SCAN_sensor_metadata()} and \code{SCAN_site_metadata()} return a \code{data.frame}. \code{NULL} on bad request. } \description{ Query soil/climate data from USDA-NRCS SCAN Stations