tabbedDataRetrievals.R 4.59 KB
Newer Older
Laura A DeCicco's avatar
Laura A DeCicco committed
1
2
3
4
5
6
.onAttach <- function(libname, pkgname) {
  if("package:reshape" %in% search()){
    packageStartupMessage("Caution: The reshape package interferes with some functions in the dataRetrieval package.")
  }
}

7
#' Retrieval functions for USGS and EPA data
Laura A DeCicco's avatar
Laura A DeCicco committed
8
9
#'
#' \tabular{ll}{
Laura A DeCicco's avatar
Laura A DeCicco committed
10
#' Package: \tab dataRetrieval\cr
Laura A DeCicco's avatar
Laura A DeCicco committed
11
#' Type: \tab Package\cr
12
13
#' License: \tab Unlimited for this package, dependencies have more restrictive licensing.\cr
#' Copyright: \tab This software is in the public domain because it contains materials
Laura A DeCicco's avatar
Laura A DeCicco committed
14
15
16
#' that originally came from the United States Geological Survey, an agency of
#' the United States Department of Interior. For more information, see the
#' official USGS copyright policy at
Laura A DeCicco's avatar
Laura A DeCicco committed
17
#' https://www.usgs.gov/visual-id/credit_usgs.html#copyright\cr
Laura A DeCicco's avatar
Laura A DeCicco committed
18
19
20
#' LazyLoad: \tab yes\cr
#' }
#'
Laura A DeCicco's avatar
Laura A DeCicco committed
21
22
#' Retrieval functions for USGS and EPA hydrologic and water quality data. 
#' 
Laura A DeCicco's avatar
Laura A DeCicco committed
23
#' Please see \url{https://pubs.usgs.gov/tm/04/a10/} for more information.
Laura A DeCicco's avatar
Laura A DeCicco committed
24
#'
Laura A DeCicco's avatar
Laura A DeCicco committed
25
#' @name dataRetrieval-package
Laura A DeCicco's avatar
Laura A DeCicco committed
26
#' @docType package
Laura A DeCicco's avatar
Laura A DeCicco committed
27
#' @author Laura De Cicco \email{ldecicco@@usgs.gov}
28
#' @keywords USGS, web services
Laura A DeCicco's avatar
Laura A DeCicco committed
29
30
NULL

Laura A DeCicco's avatar
Laura A DeCicco committed
31
32
33
#' List of USGS parameter codes
#'
#' Complete list of USGS parameter codes as of November 7, 2014. The data was pulled from
Laura A DeCicco's avatar
Laura A DeCicco committed
34
#' \url{https://nwis.waterdata.usgs.gov/nwis/pmcodes/pmcodes?radio_pm_search=param_group&pm_group=All+--+include+all+parameter+groups&
Laura A DeCicco's avatar
Laura A DeCicco committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#' format=rdb&show=parameter_group_nm&show=parameter_nm&show=casrn&show=srsname&show=parameter_units}
#'
#' @name parameterCdFile
#' @return parameterData data frame with information about USGS parameters.
#'
#' \tabular{lll}{
#' Name \tab Type \tab Description\cr
#' parameter_cd \tab character \tab 5-digit USGS parameter code \cr
#' parameter_group_nm \tab character \tab USGS parameter group name\cr
#' parameter_nm \tab character \tab USGS parameter name\cr
#' casrn \tab character \tab Chemical Abstracts Service (CAS) Registry Number\cr
#' srsname \tab character \tab Substance Registry Services Name\cr
#' parameter_units \tab character \tab Parameter units\cr
#' }
#' 
#'
#'@docType data
#'@export parameterCdFile 
Laura A DeCicco's avatar
Laura A DeCicco committed
53
#'@keywords internal
Laura A DeCicco's avatar
Laura A DeCicco committed
54
55
56
57
58
59
60
#'@examples
#'head(parameterCdFile[,1:2])
NULL

#' Data to convert USGS parameter code to characteristic names
#'
#' Data pulled from Water Quality Portal on November 25, 2014. The data was pulled from
Laura A DeCicco's avatar
Laura A DeCicco committed
61
#' \url{https://www.waterqualitydata.us/public_srsnames?mimeType=json}.
Laura A DeCicco's avatar
Laura A DeCicco committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#'
#' @name pCodeToName
#' @return pCodeToName data frame with information about USGS parameters and how they
#' relate to characteristic names (useful for WQP requests).
#'
#' \tabular{lll}{
#' Name \tab Type \tab Description\cr
#' parm_cd \tab character \tab 5-digit USGS parameter code \cr
#' description \tab character \tab Parameter description\cr
#' characteristicname \tab character \tab Characteristic Name \cr
#' measureunitcode \tab character \tab Parameter units\cr
#' resultsamplefraction \tab character \tab Result sample fraction text\cr
#' resulttemperaturebasis \tab character \tab Temperature basis information\cr
#' resultstatisticalbasis \tab character \tab Statistical basis\cr
#' resulttimebasis \tab character \tab Time basis\cr
#' resultweightbasis \tab character \tab Weight basis\cr
#' resultparticlesizebasis \tab character \tab Particle size basis\cr
#' last_rev_dt \tab character \tab Latest revision of information\cr
#' }
#' @docType data
#' @export pCodeToName 
83
#' @keywords internal
Laura A DeCicco's avatar
Laura A DeCicco committed
84
85
86
#' @examples
#' head(pCodeToName[,1:2])
NULL
87
88
89

#' US State Code Lookup Table
#'
Laura A DeCicco's avatar
Laura A DeCicco committed
90
#' Data pulled from \url{https://www2.census.gov/geo/docs/reference/state.txt}
91
92
93
94
95
96
97
#' on April 1, 2015. 
#'
#' @name stateCd
#' @return stateCd data frame.
#'
#' \tabular{lll}{
#' Name \tab Type \tab Description\cr
Read, Jordan S.'s avatar
Read, Jordan S. committed
98
99
100
101
#' STATE \tab character \tab FIPS State Code  \cr
#' STUSAB \tab character \tab Official United States Postal Service (USPS) Code \cr
#' STATE_NAME \tab character \tab State Name \cr
#' STATENS \tab character \tab  Geographic Names Information System Identifier (GNISID)\cr
102
103
104
105
106
107
108
109
110
111
#' }
#' @docType data
#' @export stateCd
#' @keywords USGS stateCd
#' @examples
#' head(stateCd)
NULL

#' US County Code Lookup Table
#'
Laura A DeCicco's avatar
Laura A DeCicco committed
112
#' Data pulled from \url{https://www2.census.gov/geo/docs/reference/codes/files/national_county.txt}
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#' on April 1, 2015. 
#'
#' @name countyCd
#' @return countyCd data frame.
#'
#' \tabular{lll}{
#' Name \tab Type \tab Description\cr
#' STUSAB \tab character \tab State abbreviation \cr
#' STATE \tab character \tab two-digit ANSI code  \cr
#' COUNTY \tab character \tab three-digit county code \cr
#' COUNTY_NAME \tab character \tab County full name \cr
#' COUNTY_ID \tab character \tab County id \cr
#' }
#' @docType data
#' @export countyCd
#' @keywords USGS countyCd
#' @examples
#' head(countyCd)
NULL