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

Merge pull request #33 from ldecicco-USGS/master

Fixed unit data examples.
parents 5e47e2da 378f8dda
......@@ -11,4 +11,5 @@
^\.Rproj\.Rhistory
^\.Rproj\.travis.yml
^\.Rproj\appveyor.yml
appveyor.yml
Package: dataRetrieval
Type: Package
Title: Retrieval functions for hydrologic data
Version: 1.4.1.9000
Date: 2014-10-06
Version: 1.4.0
Date: 2014-10-13
Authors@R: c( person("Robert", "Hirsch", role = c("aut"),
email = "rhirsch@usgs.gov"),
person("Laura", "DeCicco", role = c("aut","cre"),
......@@ -21,7 +21,6 @@ Imports:
zoo,
XML,
RCurl,
dplyr,
reshape2,
lubridate
Suggests:
......
......@@ -12,16 +12,16 @@
#' siteNumber <- "02177000"
#' startDate <- "2012-09-01"
#' endDate <- "2012-10-01"
#' offering <- '00003'
#' property <- '00060'
#' offering <- "00003"
#' property <- "00060"
#' obs_url <- constructNWISURL(siteNumber,property,
#' startDate,endDate,'dv',format='tsv')
#' startDate,endDate,"dv",format="tsv")
#' data <- getRDB1Data(obs_url)
#' urlMulti <- constructNWISURL("04085427",c("00060","00010"),
#' startDate,endDate,'dv',statCd=c("00003","00001"),'tsv')
#' startDate,endDate,"dv",statCd=c("00003","00001"),"tsv")
#' multiData <- getRDB1Data(urlMulti)
#' unitDataURL <- constructNWISURL(siteNumber,property,
#' as.character(Sys.Date()),as.character(Sys.Date()),'uv',format='tsv')
#' "2014-10-10","2014-10-10","uv",format="tsv")
#' unitData <- getRDB1Data(unitDataURL, asDateTime=TRUE)
getRDB1Data <- function(obs_url,asDateTime=FALSE, qw=FALSE){
......
......@@ -26,7 +26,7 @@
#' startGW,endGW, service="gwlevels", format="xml",interactive=FALSE)
#' groundWater <- getWaterML1Data(groundwaterExampleURL)
#' unitDataURL <- constructNWISURL(siteNumber,property,
#' as.character(Sys.Date()),as.character(Sys.Date()),'uv',format='xml')
#' "2014-10-10","2014-10-10",'uv',format='xml')
#' unitData <- getWaterML1Data(unitDataURL)
getWaterML1Data <- function(obs_url){
......
......@@ -12,9 +12,10 @@
#' rawData <- getNWISdvData(siteNumber,c("00010","00060","00300"),
#' "2001-01-01","2002-01-01",statCd=c("00001","00003"))
#' rawData <- renameColumns(rawData)
#' today <- as.character(Sys.Date())
#' rawData2 <- getNWISunitData(siteNumber,c("00010","00060"),today,today)
#' date <- "2014-10-10"
#' rawData2 <- getNWISunitData(siteNumber,c("00010","00060"),date,date)
#' rawData2 <- renameColumns(rawData2)
#' head(rawData2)
renameColumns <- function(rawData){
columnNames <- names(rawData)
......
......@@ -18,11 +18,13 @@
#' @examples
#' siteNumber <- '05114000'
#' parameterCd <- '00060'
#' startDate <- as.character(Sys.Date())
#' endDate <- as.character(Sys.Date())
#' startDate <- "2014-10-10"
#' endDate <- "2014-10-10"
#' # These examples require an internet connection to run
#' rawData <- getNWISunitData(siteNumber,parameterCd,startDate,endDate)
#' summary(rawData)
#' rawData2 <- getNWISunitData(siteNumber,parameterCd,startDate,endDate,"tsv")
#' summary(rawData2)
getNWISunitData <- function (siteNumber,parameterCd,startDate,endDate,format="xml",interactive=TRUE){
url <- constructNWISURL(siteNumber,parameterCd,startDate,endDate,"uv",format=format,interactive=interactive)
......
......@@ -32,11 +32,13 @@ A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov
\examples{
siteNumber <- '05114000'
parameterCd <- '00060'
startDate <- as.character(Sys.Date())
endDate <- as.character(Sys.Date())
startDate <- "2014-10-10"
endDate <- "2014-10-10"
# These examples require an internet connection to run
rawData <- getNWISunitData(siteNumber,parameterCd,startDate,endDate)
summary(rawData)
rawData2 <- getNWISunitData(siteNumber,parameterCd,startDate,endDate,"tsv")
summary(rawData2)
}
\keyword{USGS}
\keyword{data}
......
......@@ -23,16 +23,16 @@ NWIS site, parameter code, statistic, startdate and enddate.
siteNumber <- "02177000"
startDate <- "2012-09-01"
endDate <- "2012-10-01"
offering <- '00003'
property <- '00060'
offering <- "00003"
property <- "00060"
obs_url <- constructNWISURL(siteNumber,property,
startDate,endDate,'dv',format='tsv')
startDate,endDate,"dv",format="tsv")
data <- getRDB1Data(obs_url)
urlMulti <- constructNWISURL("04085427",c("00060","00010"),
startDate,endDate,'dv',statCd=c("00003","00001"),'tsv')
startDate,endDate,"dv",statCd=c("00003","00001"),"tsv")
multiData <- getRDB1Data(urlMulti)
unitDataURL <- constructNWISURL(siteNumber,property,
as.character(Sys.Date()),as.character(Sys.Date()),'uv',format='tsv')
"2014-10-10","2014-10-10","uv",format="tsv")
unitData <- getRDB1Data(unitDataURL, asDateTime=TRUE)
}
......@@ -34,7 +34,7 @@ groundwaterExampleURL <- constructNWISURL(groundWaterSite, NA,
startGW,endGW, service="gwlevels", format="xml",interactive=FALSE)
groundWater <- getWaterML1Data(groundwaterExampleURL)
unitDataURL <- constructNWISURL(siteNumber,property,
as.character(Sys.Date()),as.character(Sys.Date()),'uv',format='xml')
"2014-10-10","2014-10-10",'uv',format='xml')
unitData <- getWaterML1Data(unitDataURL)
}
......@@ -20,9 +20,10 @@ siteNumber <- '05114000'
rawData <- getNWISdvData(siteNumber,c("00010","00060","00300"),
"2001-01-01","2002-01-01",statCd=c("00001","00003"))
rawData <- renameColumns(rawData)
today <- as.character(Sys.Date())
rawData2 <- getNWISunitData(siteNumber,c("00010","00060"),today,today)
date <- "2014-10-10"
rawData2 <- getNWISunitData(siteNumber,c("00010","00060"),date,date)
rawData2 <- renameColumns(rawData2)
head(rawData2)
}
\keyword{USGS}
\keyword{data}
......
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