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

More examplesIf

parent ee765ff1
...@@ -21,7 +21,7 @@ jobs: ...@@ -21,7 +21,7 @@ jobs:
- name: Install pak and query dependencies - name: Install pak and query dependencies
run: | run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
install.packages(c("maptools", "maps", "patchwork")) install.packages(c("zoo", "maps", "patchwork"))
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0} shell: Rscript {0}
......
...@@ -136,7 +136,7 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){ ...@@ -136,7 +136,7 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
#' "America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla" #' "America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla"
#' @importFrom xml2 xml_attr xml_find_all xml_text #' @importFrom xml2 xml_attr xml_find_all xml_text
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0" #' baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0"
#' URL <- paste(baseURL, "sites=01646500", #' URL <- paste(baseURL, "sites=01646500",
#' "startDT=2014-09-01", #' "startDT=2014-09-01",
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#' #'
#' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}} #' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' # Examples not run for time considerations #' # Examples not run for time considerations
#' #'
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}} #' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}
#' @export #' @export
#' @keywords data import USGS web service #' @keywords data import USGS web service
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_id <- '04085427' #' site_id <- '04085427'
#' startDate <- '2012-01-01' #' startDate <- '2012-01-01'
#' endDate <- '2012-06-30' #' endDate <- '2012-06-30'
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#' comment \tab character \tab Header comments from the RDB file \cr #' comment \tab character \tab Header comments from the RDB file \cr
#' } #' }
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' #'
#' siteINFO <- readNWISsite('05114000') #' siteINFO <- readNWISsite('05114000')
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#' #'
#' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}} #' @seealso \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_id <- '05114000' #' site_id <- '05114000'
#' parameterCd <- '00060' #' parameterCd <- '00060'
#' startDate <- "2014-10-10" #' startDate <- "2014-10-10"
...@@ -130,7 +130,7 @@ readNWISuv <- function (siteNumbers,parameterCd,startDate="",endDate="", tz="UTC ...@@ -130,7 +130,7 @@ readNWISuv <- function (siteNumbers,parameterCd,startDate="",endDate="", tz="UTC
#' } #' }
#' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}} #' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_ids <- c('01594440','040851325') #' site_ids <- c('01594440','040851325')
#' \donttest{ #' \donttest{
#' data <- readNWISpeak(site_ids) #' data <- readNWISpeak(site_ids)
...@@ -213,7 +213,7 @@ readNWISpeak <- function (siteNumbers,startDate="",endDate="", asDateTime=TRUE, ...@@ -213,7 +213,7 @@ readNWISpeak <- function (siteNumbers,startDate="",endDate="", asDateTime=TRUE,
#'relate flow to stage. #'relate flow to stage.
#' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}} #' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_id <- '01594440' #' site_id <- '01594440'
#' \donttest{ #' \donttest{
#' data <- readNWISrating(site_id, "base") #' data <- readNWISrating(site_id, "base")
...@@ -294,7 +294,7 @@ readNWISrating <- function (siteNumber,type="base",convertType = TRUE){ ...@@ -294,7 +294,7 @@ readNWISrating <- function (siteNumber,type="base",convertType = TRUE){
#' } #' }
#' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}} #' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_ids <- c('01594440','040851325') #' site_ids <- c('01594440','040851325')
#' \donttest{ #' \donttest{
#' data <- readNWISmeas(site_ids) #' data <- readNWISmeas(site_ids)
...@@ -401,7 +401,7 @@ readNWISmeas <- function (siteNumbers,startDate="",endDate="", tz="UTC", expande ...@@ -401,7 +401,7 @@ readNWISmeas <- function (siteNumbers,startDate="",endDate="", tz="UTC", expande
#' #'
#' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}} #' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' site_id <- "434400121275801" #' site_id <- "434400121275801"
#' \donttest{ #' \donttest{
#' data <- readNWISgwl(site_id) #' data <- readNWISgwl(site_id)
...@@ -478,7 +478,7 @@ readNWISgwl <- function(siteNumbers, startDate = "", endDate = "", ...@@ -478,7 +478,7 @@ readNWISgwl <- function(siteNumbers, startDate = "", endDate = "",
#' } #' }
#' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}} #' @seealso \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' x1 <- readNWISstat(siteNumbers=c("02319394"), #' x1 <- readNWISstat(siteNumbers=c("02319394"),
#' parameterCd=c("00060"), #' parameterCd=c("00060"),
...@@ -549,7 +549,7 @@ readNWISstat <- function(siteNumbers, parameterCd, startDate = "", endDate = "", ...@@ -549,7 +549,7 @@ readNWISstat <- function(siteNumbers, parameterCd, startDate = "", endDate = "",
#' County and state fields will be included as appropriate. #' County and state fields will be included as appropriate.
#' #'
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' #All data for a county #' #All data for a county
#' allegheny <- readNWISuse(stateCd = "Pennsylvania",countyCd = "Allegheny") #' allegheny <- readNWISuse(stateCd = "Pennsylvania",countyCd = "Allegheny")
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
#' queryTime \tab POSIXct \tab The time the data was returned \cr #' queryTime \tab POSIXct \tab The time the data was returned \cr
#' } #' }
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' nameToUse <- "pH" #' nameToUse <- "pH"
#' pHData <- readWQPdata(siteid="USGS-04024315",characteristicName=nameToUse) #' pHData <- readWQPdata(siteid="USGS-04024315",characteristicName=nameToUse)
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
#' @export #' @export
#' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, #' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}},
#' \code{\link{readNWISqw}}, and \code{\link{importWQP}} #' \code{\link{readNWISqw}}, and \code{\link{importWQP}}
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' rawPcode <- readWQPqw('USGS-01594440','01075', '', '') #' rawPcode <- readWQPqw('USGS-01594440','01075', '', '')
#' rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '') #' rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '')
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#' queryTime \tab POSIXct \tab The time the data was returned \cr #' queryTime \tab POSIXct \tab The time the data was returned \cr
#' } #' }
#' @export #' @export
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' #'
#' availableData <- whatNWISdata(siteNumber = '05114000') #' availableData <- whatNWISdata(siteNumber = '05114000')
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#' #'
#' @export #' @export
#' @seealso whatNWISdata #' @seealso whatNWISdata
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' #'
#' site1 <- whatWQPsites(siteid="USGS-01594440") #' site1 <- whatWQPsites(siteid="USGS-01594440")
......
...@@ -91,3 +91,4 @@ reference: ...@@ -91,3 +91,4 @@ reference:
- constructWQPURL - constructWQPURL
- getQuerySummary - getQuerySummary
- getWebServiceData - getWebServiceData
- is_dataRetrieval_user
...@@ -21,6 +21,7 @@ Returns data frame columns of all information with each time series measurement; ...@@ -21,6 +21,7 @@ Returns data frame columns of all information with each time series measurement;
Anything defined as a default, is returned as an attribute of that data frame. Anything defined as a default, is returned as an attribute of that data frame.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0" baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0"
URL <- paste(baseURL, "sites=01646500", URL <- paste(baseURL, "sites=01646500",
"startDT=2014-09-01", "startDT=2014-09-01",
...@@ -32,4 +33,5 @@ URL <- paste(baseURL, "sites=01646500", ...@@ -32,4 +33,5 @@ URL <- paste(baseURL, "sites=01646500",
timesereies <- importWaterML2(URL, asDateTime=TRUE, tz="UTC") timesereies <- importWaterML2(URL, asDateTime=TRUE, tz="UTC")
} }
\dontshow{\}) # examplesIf}
} }
...@@ -65,6 +65,7 @@ Arguments to the function should be based on \url{https://waterservices.usgs.gov ...@@ -65,6 +65,7 @@ Arguments to the function should be based on \url{https://waterservices.usgs.gov
See examples below for ideas of constructing queries. See examples below for ideas of constructing queries.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
# Examples not run for time considerations # Examples not run for time considerations
...@@ -142,6 +143,7 @@ peak_data <- readNWISdata(service = "peak", ...@@ -142,6 +143,7 @@ peak_data <- readNWISdata(service = "peak",
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}} \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}}
......
...@@ -55,6 +55,7 @@ queryTime \tab POSIXct \tab The time the data was returned \cr ...@@ -55,6 +55,7 @@ queryTime \tab POSIXct \tab The time the data was returned \cr
Imports data from NWIS web service. This function gets the data from here: \url{https://waterservices.usgs.gov/} Imports data from NWIS web service. This function gets the data from here: \url{https://waterservices.usgs.gov/}
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- '04085427' site_id <- '04085427'
startDate <- '2012-01-01' startDate <- '2012-01-01'
endDate <- '2012-06-30' endDate <- '2012-06-30'
...@@ -75,6 +76,7 @@ attr(x, "variableInfo") ...@@ -75,6 +76,7 @@ attr(x, "variableInfo")
site <- "05212700" site <- "05212700"
notActive <- readNWISdv(site, "00060", "2014-01-01","2014-01-07") notActive <- readNWISdv(site, "00060", "2014-01-01","2014-01-07")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{renameNWISColumns}}, \code{\link{importWaterML1}} \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}
......
...@@ -67,6 +67,7 @@ is specified as FALSE. Sites with non-standard date formats (i.e. lacking a day) ...@@ -67,6 +67,7 @@ is specified as FALSE. Sites with non-standard date formats (i.e. lacking a day)
See \url{https://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information. See \url{https://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- "434400121275801" site_id <- "434400121275801"
\donttest{ \donttest{
data <- readNWISgwl(site_id) data <- readNWISgwl(site_id)
...@@ -79,6 +80,7 @@ data4 <- readNWISgwl("425957088141001", startDate = "1980-01-01") ...@@ -79,6 +80,7 @@ data4 <- readNWISgwl("425957088141001", startDate = "1980-01-01")
data5 <- readNWISgwl("263819081585801", parameterCd = "72019") data5 <- readNWISgwl("263819081585801", parameterCd = "72019")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -65,6 +65,7 @@ Reads surface-water measurement data from NWISweb. Data is retrieved from \url{h ...@@ -65,6 +65,7 @@ Reads surface-water measurement data from NWISweb. Data is retrieved from \url{h
See \url{https://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. See \url{https://waterdata.usgs.gov/usa/nwis/sw} for details about surface water.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_ids <- c('01594440','040851325') site_ids <- c('01594440','040851325')
\donttest{ \donttest{
data <- readNWISmeas(site_ids) data <- readNWISmeas(site_ids)
...@@ -73,6 +74,7 @@ Meas05316840.ex <- readNWISmeas("05316840",expanded=TRUE) ...@@ -73,6 +74,7 @@ Meas05316840.ex <- readNWISmeas("05316840",expanded=TRUE)
Meas07227500.ex <- readNWISmeas("07227500",expanded=TRUE) Meas07227500.ex <- readNWISmeas("07227500",expanded=TRUE)
Meas07227500.exRaw <- readNWISmeas("07227500",expanded=TRUE, convertType = FALSE) Meas07227500.exRaw <- readNWISmeas("07227500",expanded=TRUE, convertType = FALSE)
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -62,6 +62,7 @@ converting complete dates to a "Date" object, and converting incomplete dates to ...@@ -62,6 +62,7 @@ converting complete dates to a "Date" object, and converting incomplete dates to
needed, set the `asDateTime` argument to FALSE. No dates will be converted to R Date objects. needed, set the `asDateTime` argument to FALSE. No dates will be converted to R Date objects.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_ids <- c('01594440','040851325') site_ids <- c('01594440','040851325')
\donttest{ \donttest{
data <- readNWISpeak(site_ids) data <- readNWISpeak(site_ids)
...@@ -69,6 +70,7 @@ data2 <- readNWISpeak(site_ids, asDateTime=FALSE) ...@@ -69,6 +70,7 @@ data2 <- readNWISpeak(site_ids, asDateTime=FALSE)
stations<-c("06011000") stations<-c("06011000")
peakdata<-readNWISpeak(stations,convertType=FALSE) peakdata<-readNWISpeak(stations,convertType=FALSE)
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -45,11 +45,13 @@ Not all active USGS streamgages have traditional rating curves that ...@@ -45,11 +45,13 @@ Not all active USGS streamgages have traditional rating curves that
relate flow to stage. relate flow to stage.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- '01594440' site_id <- '01594440'
\donttest{ \donttest{
data <- readNWISrating(site_id, "base") data <- readNWISrating(site_id, "base")
attr(data, "RATING") attr(data, "RATING")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -69,12 +69,14 @@ comment \tab character \tab Header comments from the RDB file \cr ...@@ -69,12 +69,14 @@ comment \tab character \tab Header comments from the RDB file \cr
Imports data from USGS site file site. This function gets data from here: \url{https://waterservices.usgs.gov/} Imports data from USGS site file site. This function gets data from here: \url{https://waterservices.usgs.gov/}
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
siteINFO <- readNWISsite('05114000') siteINFO <- readNWISsite('05114000')
siteINFOMulti <- readNWISsite(c('05114000','09423350')) siteINFOMulti <- readNWISsite(c('05114000','09423350'))
} }
\dontshow{\}) # examplesIf}
} }
\keyword{USGS} \keyword{USGS}
\keyword{data} \keyword{data}
......
...@@ -59,6 +59,7 @@ Retrieves site statistics from the USGS Statistics Web Service beta. ...@@ -59,6 +59,7 @@ Retrieves site statistics from the USGS Statistics Web Service beta.
See \url{https://waterservices.usgs.gov/rest/Statistics-Service.html} for more information. See \url{https://waterservices.usgs.gov/rest/Statistics-Service.html} for more information.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
x1 <- readNWISstat(siteNumbers=c("02319394"), x1 <- readNWISstat(siteNumbers=c("02319394"),
parameterCd=c("00060"), parameterCd=c("00060"),
...@@ -77,6 +78,7 @@ x <- readNWISstat(siteNumbers=c("02171500"), ...@@ -77,6 +78,7 @@ x <- readNWISstat(siteNumbers=c("02171500"),
statType=c("mean","median"), statType=c("mean","median"),
startDate="2000",endDate="2010") startDate="2000",endDate="2010")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
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