Skip to content
Snippets Groups Projects
Commit aca25b70 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Updated examples to not use interactive=FALSE. Rebuilt package.

parent c3d90cb4
No related branches found
No related tags found
No related merge requests found
Showing
with 34 additions and 41 deletions
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#' @seealso \code{\link{getDVData}}, \code{\link{populateSampleColumns}} #' @seealso \code{\link{getDVData}}, \code{\link{populateSampleColumns}}
#' @examples #' @examples
#' # These examples require an internet connection to run #' # These examples require an internet connection to run
#' Daily <- getDVData('01594440','00060', '1985-01-01', '1985-03-31', interactive=FALSE) #' Daily <- getDVData('01594440','00060', '1985-01-01', '1985-03-31')
#' Sample <- getSampleData('01594440','01075', '1985-01-01', '1985-03-31', interactive=FALSE) #' Sample <- getSampleData('01594440','01075', '1985-01-01', '1985-03-31')
#' Sample <- mergeReport(interactive=FALSE) #' Sample <- mergeReport()
mergeReport<-function(localDaily = Daily, localSample = Sample, interactive=TRUE){ mergeReport<-function(localDaily = Daily, localSample = Sample, interactive=TRUE){
if (interactive){ if (interactive){
dataOverview(localDaily, localSample) dataOverview(localDaily, localSample)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#' value <- c(1,2,3) #' value <- c(1,2,3)
#' code <- c("","","") #' code <- c("","","")
#' dataInput <- data.frame(dateTime, value, code, stringsAsFactors=FALSE) #' dataInput <- data.frame(dateTime, value, code, stringsAsFactors=FALSE)
#' Daily <- populateDaily(dataInput, 2, interactive=FALSE) #' Daily <- populateDaily(dataInput, 2)
populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a dataframe with at least dateTime, value, code populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a dataframe with at least dateTime, value, code
# require(zoo) # require(zoo)
...@@ -55,12 +55,12 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da ...@@ -55,12 +55,12 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da
zeroNums <- length(which(localDaily$Q == 0)) zeroNums <- length(which(localDaily$Q == 0))
if (negNums > 0) { if (negNums > 0) {
cat("There were ", as.character(negNums), " negative flow days \n") cat("There were", as.character(negNums), "negative flow days \n")
cat("Negative values are not supported in the EGRET package\n") cat("Negative values are not supported in the EGRET package\n")
} }
if (zeroNums > 0){ if (zeroNums > 0){
cat("There were ", as.character(zeroNums), " zero flow days \n") cat("There were", as.character(zeroNums), "zero flow days \n")
} }
cat("All days had",as.character(qshift),"cms added to the discharge value.\n") cat("All days had",as.character(qshift),"cms added to the discharge value.\n")
...@@ -90,7 +90,7 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da ...@@ -90,7 +90,7 @@ populateDaily <- function(rawData,qConvert,interactive=TRUE){ # rawData is a da
dataPoints <- nrow(localDaily) dataPoints <- nrow(localDaily)
difference <- (localDaily$Julian[dataPoints] - localDaily$Julian[1])+1 difference <- (localDaily$Julian[dataPoints] - localDaily$Julian[1])+1
if (interactive){ if (interactive){
cat("There are ", as.character(dataPoints), "data points, and ", as.character(difference), "days.\n") cat("There are", as.character(dataPoints), "data points, and", as.character(difference), "days.\n")
#these next two lines show the user where the gaps in the data are if there are any #these next two lines show the user where the gaps in the data are if there are any
n<-nrow(localDaily) n<-nrow(localDaily)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#' INFO$param.units <- parameterData$parameter_units #' INFO$param.units <- parameterData$parameter_units
#' INFO$paramShortName <- parameterData$srsname #' INFO$paramShortName <- parameterData$srsname
#' INFO$paramNumber <- parameterData$parameter_cd #' INFO$paramNumber <- parameterData$parameter_cd
#' INFO <- populateParameterINFO(parameterCd,interactive=FALSE) #' INFO <- populateParameterINFO(parameterCd)
populateParameterINFO <- function(parameterCd, localINFO=INFO, interactive=TRUE){ populateParameterINFO <- function(parameterCd, localINFO=INFO, interactive=TRUE){
if (nzchar(parameterCd)){ if (nzchar(parameterCd)){
if(interactive){ if(interactive){
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#' #This example requires an internet connection to run #' #This example requires an internet connection to run
#' INFO <- getSiteFileData('01594440') #' INFO <- getSiteFileData('01594440')
#' siteNumber <- "01594440" #' siteNumber <- "01594440"
#' siteINFO <- populateSiteINFO(INFO, siteNumber,interactive=FALSE) #' siteINFO <- populateSiteINFO(INFO, siteNumber)
populateSiteINFO <- function(INFO, siteNumber,interactive=TRUE){ populateSiteINFO <- function(INFO, siteNumber,interactive=TRUE){
if (nzchar(siteNumber)){ if (nzchar(siteNumber)){
......
...@@ -7,20 +7,9 @@ ...@@ -7,20 +7,9 @@
#' @return rawData dataframe with improved column names #' @return rawData dataframe with improved column names
#' @export #' @export
#' @examples #' @examples
#' # These examples require an internet connection to run #' # This example requires an internet connection to run
#' siteNumber <- '05114000' #' rawData2 <- retrieveNWISData(siteNumber,c("00010","00060","00300"),"2001-01-01","2002-01-01",StatCd=c("00001","00003"))
#' ParameterCd <- c('00060','00065')
#' StartDate <- as.character(Sys.Date())
#' EndDate <- as.character(Sys.Date())
#' # These examples require an internet connection to run
#' rawData <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,interactive=FALSE)
#' rawData <- renameColumns(rawData)
#' rawData2 <- retrieveNWISData(siteNumber,c("00010","00060","00300"),"2001-01-01","2002-01-01",StatCd=c("00001","00003"),interactive=FALSE)
#' rawData2 <- renameColumns(rawData2) #' rawData2 <- renameColumns(rawData2)
#' site <- '04027000'
#' pCodes <- c("00010","00060","00095","00300","00400","63680")
#' rawData3 <- retrieveUnitNWISData(site,pCodes,StartDate,EndDate,interactive=FALSE)
#' rawData3 <- renameColumns(rawData3)
renameColumns <- function(rawData){ renameColumns <- function(rawData){
columnNames <- names(rawData) columnNames <- names(rawData)
...@@ -62,6 +51,10 @@ renameColumns <- function(rawData){ ...@@ -62,6 +51,10 @@ renameColumns <- function(rawData){
dataColCDS <- paste(dataColNames, "_cd") dataColCDS <- paste(dataColNames, "_cd")
columnNames[which(columnNames %in% dataCol_names)] <- dataColNames columnNames[which(columnNames %in% dataCol_names)] <- dataColNames
columnNames[which(columnNames %in% dataCol_cds)] <- dataColCDS columnNames[which(columnNames %in% dataCol_cds)] <- dataColCDS
columnNames <- gsub("[$,. ]","_",columnNames)
columnNames <- gsub("__","_",columnNames)
names(rawData) <- columnNames names(rawData) <- columnNames
return(rawData) return(rawData)
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
#' endDate <- '2012-06-30' #' endDate <- '2012-06-30'
#' pCode <- "00060" #' pCode <- "00060"
#' rawDailyQ <- retrieveNWISData(siteNumber,pCode, startDate, endDate) #' rawDailyQ <- retrieveNWISData(siteNumber,pCode, startDate, endDate)
#' rawDailyTemperature <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001',interactive=FALSE) #' rawDailyTemperature <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001')
#' rawDailyTemperatureTSV <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001',format="tsv",interactive=FALSE) #' rawDailyTemperatureTSV <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001',format="tsv")
#' rawDailyQAndTempMeanMax <- retrieveNWISData(siteNumber,c('00010','00060'), startDate, endDate, StatCd=c('00001','00003'), interactive=FALSE) #' rawDailyQAndTempMeanMax <- retrieveNWISData(siteNumber,c('00010','00060'), startDate, endDate, StatCd=c('00001','00003'))
retrieveNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,StatCd="00003",format="tsv",interactive=TRUE){ retrieveNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,StatCd="00003",format="tsv",interactive=TRUE){
url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"dv",statCd=StatCd,format=format) url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"dv",statCd=StatCd,format=format)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#' # To get data in Sample dataframe format: #' # To get data in Sample dataframe format:
#' data <- rawNWISqwData[,names(rawNWISqwData) != "site"] #' data <- rawNWISqwData[,names(rawNWISqwData) != "site"]
#' data$dateTime <- as.Date(data$dateTime) #' data$dateTime <- as.Date(data$dateTime)
#' compressedData <- compressData(data, interactive=interactive) #' compressedData <- compressData(data)
#' Sample <- populateSampleColumns(compressedData) #' Sample <- populateSampleColumns(compressedData)
retrieveNWISqwData <- function (siteNumber,pCodes,startDate,endDate){ retrieveNWISqwData <- function (siteNumber,pCodes,startDate,endDate){
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#' StartDate <- as.character(Sys.Date()) #' StartDate <- as.character(Sys.Date())
#' EndDate <- as.character(Sys.Date()) #' EndDate <- as.character(Sys.Date())
#' # These examples require an internet connection to run #' # These examples require an internet connection to run
#' rawData <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,interactive=FALSE) #' rawData <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate)
#' rawData2 <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,"tsv",interactive=FALSE) #' rawData2 <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,"tsv")
retrieveUnitNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,format="xml",interactive=TRUE){ retrieveUnitNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,format="xml",interactive=TRUE){
url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"uv",format=format) url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"uv",format=format)
......
No preview for this file type
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
\examples{ \examples{
startDate <- '1985-01-01' startDate <- '1985-01-01'
endDate <- '1990-01-01' endDate <- '1990-01-01'
checkStartEndDate(startDate, endDate, interactive = FALSE) checkStartEndDate(startDate, endDate)
} }
\keyword{WRTDS} \keyword{WRTDS}
\keyword{flow} \keyword{flow}
......
...@@ -34,7 +34,7 @@ value2 <- c(2,3,4) ...@@ -34,7 +34,7 @@ value2 <- c(2,3,4)
comment3 <- c("","","<") comment3 <- c("","","<")
value3 <- c(3,4,5) value3 <- c(3,4,5)
dataInput <- data.frame(dateTime, comment1, value1, comment2, value2, comment3, value3, stringsAsFactors=FALSE) dataInput <- data.frame(dateTime, comment1, value1, comment2, value2, comment3, value3, stringsAsFactors=FALSE)
compressData(dataInput, interactive=FALSE) compressData(dataInput)
} }
\keyword{WRTDS} \keyword{WRTDS}
\keyword{flow} \keyword{flow}
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
\usage{ \usage{
constructNWISURL(siteNumber, parameterCd, startDate, constructNWISURL(siteNumber, parameterCd, startDate,
endDate, service, statCd = "00003", format = "xml", endDate, service, statCd = "00003", format = "xml",
interactive = FALSE) interactive = TRUE)
} }
\arguments{ \arguments{
\item{siteNumber}{string or vector of strings USGS site \item{siteNumber}{string or vector of strings USGS site
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
expected. The default is therefore "xml".} expected. The default is therefore "xml".}
\item{interactive}{logical Option for interactive mode. \item{interactive}{logical Option for interactive mode.
If true, there is user interaction for error handling and If TRUE, there is user interaction for error handling and
data checks.} data checks.}
} }
\value{ \value{
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
} }
\examples{ \examples{
pCode <- '01234' pCode <- '01234'
formatCheckParameterCd(pCode, interactive = FALSE) formatCheckParameterCd(pCode)
} }
\keyword{WRTDS} \keyword{WRTDS}
\keyword{flow} \keyword{flow}
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
} }
\examples{ \examples{
site<- '01234567' site<- '01234567'
formatCheckSiteNumber(site, interactive = FALSE) formatCheckSiteNumber(site)
} }
\keyword{WRTDS} \keyword{WRTDS}
\keyword{flow} \keyword{flow}
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
} }
\examples{ \examples{
# These examples require an internet connection to run # These examples require an internet connection to run
Daily <- getDVData('01594440','00060', '1985-01-01', '1985-03-31', interactive=FALSE) Daily <- getDVData('01594440','00060', '1985-01-01', '1985-03-31')
} }
\seealso{ \seealso{
\code{\link{retrieveNWISData}}, \code{\link{retrieveNWISData}},
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
} }
\examples{ \examples{
# These examples require an internet connection to run # These examples require an internet connection to run
availableData <- getDataAvailability('05114000',interactive=FALSE) availableData <- getDataAvailability('05114000')
} }
\keyword{USGS} \keyword{USGS}
\keyword{data} \keyword{data}
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
\examples{ \examples{
# Examples of how to use getDataFromFile: # Examples of how to use getDataFromFile:
# Change the file path and file name to something meaningful: # Change the file path and file name to something meaningful:
#filePath <- '~/RData/' # Sample format filePath <- '~/RData/' # Sample format
fileName <- 'ChoptankRiverFlow.txt' fileName <- 'ChoptankRiverFlow.txt'
#getDataFromFile(filePath,fileName, separator="\\t") \dontrun{getDataFromFile(filePath,fileName, separator="\\t")}
} }
\keyword{data} \keyword{data}
\keyword{file} \keyword{file}
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
\examples{ \examples{
# These examples require an internet connection to run # These examples require an internet connection to run
# Automatically gets information about site 05114000 and temperature, no interaction with user # Automatically gets information about site 05114000 and temperature, no interaction with user
INFO <- getMetaData('05114000','00010',interactive=FALSE) INFO <- getMetaData('05114000','00010')
} }
\keyword{USGS} \keyword{USGS}
\keyword{WRTDS} \keyword{WRTDS}
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
# These examples require an internet connection to run # These examples require an internet connection to run
rawProcessedSample <- getQWData('01594440','01075', '1985-01-01', '1985-03-31') rawProcessedSample <- getQWData('01594440','01075', '1985-01-01', '1985-03-31')
rawProcessedSampleAll <- getQWData('05114000','', '1985-01-01', '1985-03-31') rawProcessedSampleAll <- getQWData('05114000','', '1985-01-01', '1985-03-31')
rawProcessedSampleSelect <- getQWData('05114000','00915;00931', '1985-01-01', '1985-04-30', interactive=FALSE) rawProcessedSampleSelect <- getQWData('05114000','00915;00931', '1985-01-01', '1985-04-30')
} }
\keyword{USGS} \keyword{USGS}
\keyword{data} \keyword{data}
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
# Change the file path and file name to something meaningful: # Change the file path and file name to something meaningful:
filePath <- '~/RData/' # Sample format filePath <- '~/RData/' # Sample format
fileName <- 'ChoptankRiverNitrate.csv' fileName <- 'ChoptankRiverNitrate.csv'
#rawSampleData <- getQWDataFromFile(filePath,fileName, separator=";") \dontrun{rawSampleData <- getQWDataFromFile(filePath,fileName, separator=";")}
} }
\keyword{data} \keyword{data}
\keyword{file} \keyword{file}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment