Skip to content

Commit 821134a

Browse files
committed
update documentation to tidy style. Closes #19
1 parent 20b7401 commit 821134a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+590
-165
lines changed

R/ANNUAL_INSTANT_PEAKS.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

1313

14-
#' @title Annual maximum/minimum instantaneous flows and water levels
15-
#'
16-
#' @description Provides wrapper to turn the ANNUAL_INSTANT_PEAKS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17-
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned.
14+
#' Annual maximum/minimum instantaneous flows and water levels
1815
#'
16+
#' Provides wrapper to turn the ANNUAL_INSTANT_PEAKS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17+
#' \code{PROV_TERR_STATE_LOC} can both be supplied.
18+
#'
1919
#' @inheritParams STATIONS
2020
#' @param start_year First year of the returned record
2121
#' @param end_year Last year of the returned record
@@ -30,7 +30,9 @@
3030
#' ## Multiple province, station number not specified
3131
#' ANNUAL_INSTANT_PEAKS(PROV_TERR_STATE_LOC = c("AB","YT"), hydat_path = "H:/Hydat.sqlite3")
3232
#' }
33-
#'
33+
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537
#'
3638
ANNUAL_INSTANT_PEAKS <- function(hydat_path, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL,

R/ANNUAL_STATISTICS.R

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

1313

14-
#' @title Extract daily flows information from the HYDAT database
14+
#' Extract annual statistics information from the HYDAT database
1515
#'
16-
#' @description Provides wrapper to turn the ANNUAL_STATISTICS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17-
#' \code{PROV_TERR_STATE_LOC} must both be supplied. When STATION_NUMBER="ALL" the PROV_TERR_STATE_LOC argument decides
18-
#' where those stations come from.
16+
#' Provides wrapper to turn the ANNUAL_STATISTICS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17+
#' \code{PROV_TERR_STATE_LOC} must both be supplied.
1918
#'
2019
#' @inheritParams STATIONS
2120
#' @param start_year First year of the returned record
@@ -25,13 +24,15 @@
2524
#'
2625
#' @examples
2726
#' \donttest{
28-
#' ## Multiple stations province not specified
29-
#' ANNUAL_STATISTICS(STATION_NUMBER = c("08NM083","05AE027"), hydat_path = "H:/Hydat.sqlite3")
30-
#'
31-
#' ## Multiple province, station number not specified
32-
#' ANNUAL_STATISTICS(PROV_TERR_STATE_LOC = c("AB","SK"), hydat_path = "H:/Hydat.sqlite3")
27+
#' ## Multiple stations province not specified
28+
#' ANNUAL_STATISTICS(STATION_NUMBER = c("08NM083","05AE027"), hydat_path = "H:/Hydat.sqlite3")
29+
#'
30+
#' ## Multiple province, station number not specified
31+
#' ANNUAL_STATISTICS(PROV_TERR_STATE_LOC = c("AB","SK"), hydat_path = "H:/Hydat.sqlite3")
3332
#' }
3433
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3536
#' @export
3637

3738
ANNUAL_STATISTICS <- function(hydat_path=NULL, STATION_NUMBER =NULL, PROV_TERR_STATE_LOC=NULL,

R/DLY_FLOWS.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#'
3232
#' }
3333
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638

R/DLY_LEVELS.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#'
3030
#' }
3131
#'
32+
#' @family HYDAT functions
33+
#' @source HYDAT
3234
#' @export
3335

3436

R/SED_DLY_LOAD.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

13-
#' @title Extract daily sediment load information from the HYDAT database
13+
#' Extract daily sediment load information from the HYDAT database
1414
#'
15-
#' @description Provides wrapper to turn the SED_DLY_LOADS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
15+
#' Provides wrapper to turn the SED_DLY_LOADS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1616
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned.
1717
#' That is a large vector for \code{SED_DLY_LOADS}.
1818
#'
1919
#' @inheritParams STATIONS
2020
#' @param start_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2121
#' @param end_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2222
#'
23-
#' @return A tibble of daily suspended sediment concentration (mg/l)
23+
#' @return A tibble of daily suspended sediment loads (tonnes)
2424
#'
2525
#' @examples
2626
#' \donttest{
@@ -31,6 +31,8 @@
3131
#'
3232
#' }
3333
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638

R/SED_DLY_SUSCON.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

13-
#' @title Extract daily suspended sediment concentration information from the HYDAT database
13+
#' Extract daily suspended sediment concentration information from the HYDAT database
1414
#'
15-
#' @description Provides wrapper to turn the SED_DLY_SUSCON table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
15+
#' Provides wrapper to turn the SED_DLY_SUSCON table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1616
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned.
1717
#' That is a large vector for \code{SED_DLY_SUSCON}.
1818
#'
@@ -31,6 +31,8 @@
3131
#'
3232
#' }
3333
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638

R/SED_MONTHLY_LOADS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#' @param start_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2121
#' @param end_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2222
#'
23-
#' @return A tibble of monthly flows. This includes a \code{Date_occured} column which indicates the date of the \code{Sum_stat}. For MEAN and
23+
#' @return A tibble of monthly sediment loads. This includes a \code{Date_occured} column which indicates the date of the \code{Sum_stat}. For MEAN and
2424
#' TOTAL this is not presented as those aren't daily values.
2525
#'
2626
#' @examples

R/SED_MONTHLY_SUSCON.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#' @param start_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2121
#' @param end_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2222
#'
23-
#' @return A tibble of monthly flows. This includes a \code{Date_occured} column which indicates the date of the \code{Sum_stat}. For MEAN and
23+
#' @return A tibble of monthly suspended sediment concentrations. This includes a \code{Date_occured} column which indicates the date of the \code{Sum_stat}. For MEAN and
2424
#' TOTAL this is not presented as those aren't daily values.
2525
#'
2626
#' @examples

R/SED_SAMPLES.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

13-
#' @title Extract instantaneous sediment sample information from the HYDAT database
13+
#' Extract instantaneous sediment sample information from the HYDAT database
1414
#'
15-
#' @description Provides wrapper to turn the SED_SAMPLES table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
15+
#' Provides wrapper to turn the SED_SAMPLES table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1616
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned.
1717
#' That is a large vector for \code{SED_SAMPLES}.
1818
#'
1919
#' @inheritParams STATIONS
2020
#' @param start_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2121
#' @param end_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2222
#'
23-
#' @return A tibble of daily suspended sediment concentration (mg/l)
23+
#' @return A tibble of instantaneous sediment samples data
2424
#'
2525
#' @examples
2626
#' \donttest{
@@ -31,6 +31,8 @@
3131
#'
3232
#' }
3333
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638

R/SED_SAMPLES_PSD.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and limitations under the License.
1212

13-
#' @title Extract instantaneous sediment sample information from the HYDAT database
13+
#' Extract instantaneous sediment sample information from the HYDAT database
1414
#'
15-
#' @description Provides wrapper to turn the SED_SAMPLES_PSD table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
15+
#' Provides wrapper to turn the SED_SAMPLES_PSD table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1616
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned.
1717
#' That is a large vector for \code{SED_SAMPLES_PSD}.
1818
#'
1919
#' @inheritParams STATIONS
2020
#' @param start_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2121
#' @param end_date Leave blank if all dates are required. Date format needs to be in YYYY-MM-DD. Date is inclusive.
2222
#'
23-
#' @return A tibble of daily suspended sediment concentration (mg/l)
23+
#' @return A tibble of sediment sample particle size data
2424
#'
2525
#' @examples
2626
#' \donttest{
@@ -31,6 +31,8 @@
3131
#'
3232
#' }
3333
#'
34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638

R/STATIONS.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212

1313

1414

15-
#' @title Extract station information from the HYDAT database
15+
#' Extract station information from the HYDAT database
1616
#'
17-
#' @description Provides wrapper to turn the STATIONS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17+
#' Provides wrapper to turn the STATIONS table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1818
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned
1919
#'
20-
#' @param hydat_path Directory to the hydat database. Can be set as "Hydat.sqlite3" which will look for Hydat in the working directory.
21-
#' The hydat path can also be set in the \code{.Renviron} file so that it doesn't have to specified every function call. The path should
22-
#' set as the variable \code{hydat}. Open the \code{.Renviron} file using this command: \code{file.edit("~/.Renviron")}.
23-
#' @param STATION_NUMBER Water Survey of Canada station number. If this argument is omitted from the function call, the value of \code{PROV_TERR_STATE_LOC}
20+
#' @inheritParams AGENCY_LIST
21+
#' @param STATION_NUMBER Water Survey of Canada station number. If this argument is omitted, the value of \code{PROV_TERR_STATE_LOC}
2422
#' is returned.
25-
#' @param PROV_TERR_STATE_LOC Province, state or territory. If this argument is omitted from the function call, the value of \code{STATION_NUMBER}
26-
#' is returned. See \code{unique(STATIONS(hydat_path = "H:/Hydat.sqlite3")$PROV_TERR_STATE_LOC)}
23+
#' @param PROV_TERR_STATE_LOC Province, state or territory. If this argument is omitted, the value of \code{STATION_NUMBER}
24+
#' is returned. See \code{unique(allstations$PROV_TERR_STATE_LOC)}
2725
#'
2826
#' @return A tibble of stations and associated metadata
2927
#'
@@ -37,6 +35,8 @@
3735
#' }
3836
#'
3937
#'
38+
#' @family HYDAT functions
39+
#' @source HYDAT
4040
#' @export
4141

4242
STATIONS <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL) {

R/STN_.R

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#' @title STN_REMARKS function
1+
#' STN_REMARKS function
22
#'
3-
#' @description STN_REMARKS look-up Table
3+
#' STN_REMARKS look-up Table
44
#' @inheritParams STATIONS
55
#'
66
#' @return A tibble of STN_REMARKS
@@ -32,9 +32,9 @@ STN_REMARKS <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_
3232
stn_remarks
3333
}
3434

35-
#' @title STN_DATUM_CONVERTION function
35+
#' STN_DATUM_CONVERTION function
3636
#'
37-
#' @description STN_DATUM_CONVERTION look-up Table
37+
#' STN_DATUM_CONVERTION look-up Table
3838
#' @inheritParams STATIONS
3939
#'
4040
#' @return A tibble of STN_DATUM_CONVERTION
@@ -69,13 +69,15 @@ STN_DATUM_CONVERSION <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TE
6969
stn_datum_conversion
7070
}
7171

72-
#' @title STN_DATA_RANGE function
72+
#' STN_DATA_RANGE function
7373
#'
74-
#' @description STN_DATA_RANGE look-up Table
74+
#' STN_DATA_RANGE look-up Table
7575
#' @inheritParams STATIONS
7676
#'
7777
#' @return A tibble of STN_DATA_RANGE
7878
#'
79+
#' @family HYDAT functions
80+
#' @source HYDAT
7981
#' @export
8082
#'
8183
STN_DATA_RANGE <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL) {
@@ -101,13 +103,15 @@ STN_DATA_RANGE <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STA
101103
stn_data_range
102104
}
103105

104-
#' @title STN_DATA_COLLECTION function
106+
#' STN_DATA_COLLECTION function
105107
#'
106-
#' @description STN_DATA_COLLECTION look-up Table
108+
#' STN_DATA_COLLECTION look-up Table
107109
#' @inheritParams STATIONS
108110
#'
109111
#' @return A tibble of STN_DATA_COLLECTION
110112
#'
113+
#' @family HYDAT functions
114+
#' @source HYDAT
111115
#' @export
112116
#'
113117
STN_DATA_RANGE <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL) {
@@ -140,13 +144,15 @@ STN_DATA_RANGE <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STA
140144
}
141145

142146

143-
#' @title STN_OPERATION_SCHEDULE function
147+
#' STN_OPERATION_SCHEDULE function
144148
#'
145-
#' @description STN_OPERATION_SCHEDULE look-up Table
149+
#' STN_OPERATION_SCHEDULE look-up Table
146150
#' @inheritParams STATIONS
147151
#'
148152
#' @return A tibble of STN_OPERATION_SCHEDULE
149153
#'
154+
#' @family HYDAT functions
155+
#' @source HYDAT
150156
#' @export
151157
#'
152158
STN_OPERATION_SCHEDULE <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL) {

R/STN_REGULATION.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313

1414

15-
#' @title Extract station regulation from the HYDAT database
15+
#' Extract station regulation from the HYDAT database
1616
#'
17-
#' @description Provides wrapper to turn the STN_REGULATION table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
17+
#' Provides wrapper to turn the STN_REGULATION table in HYDAT into a tidy data frame. \code{STATION_NUMBER} and
1818
#' \code{PROV_TERR_STATE_LOC} can both be supplied. If both are omitted all values from the \code{STATIONS} table are returned
1919
#'
2020
#' @inheritParams STATIONS
@@ -31,6 +31,8 @@
3131
#' }
3232
#'
3333

34+
#' @family HYDAT functions
35+
#' @source HYDAT
3436
#' @export
3537

3638
STN_REGULATION <- function(hydat_path=NULL, STATION_NUMBER = NULL, PROV_TERR_STATE_LOC = NULL) {

0 commit comments

Comments
 (0)