You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: NEWS.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
-
# NPSutils 0.3.3 (under development)
1
+
# NPSutils 1.0.0
2
+
## 2025-12-19
3
+
* remove `get_data_packages_deprecated()` is a breaking change resulting in release of v.1.0.0.
4
+
* update documentation for `get_unit_code()`, `get_park_code()`, and `get_unit_code_info()`
2
5
3
-
##2024-12-19
6
+
##2024-12-19
4
7
* remove `validate_data_package()` as this function was listed as "still under construction" is mostly obsolete given other functions and functions in the DPchecker package.
5
8
* remove `load_domains()` as this function was not working properly and was conceived of before the data package specifications were properly set.
Copy file name to clipboardexpand all lines: R/getParkUnitInfo.R
+36-43
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
2
2
#' Dynamically access NPS park unit code data
3
3
#'
4
-
#' @description \code{get_unit_code} accesses info from irmaservices.nps.gov. Search for park or park unit with any string and return all applicable UnitCodes. Handy for use with get.dataPackage if you don't know a Park's UnitCode. allows the user to access information based on park codes
4
+
#' @description Accesses info from irmaservices.nps.gov. Search for park or park unit with any string and return all applicable UnitCodes.
5
5
#'
6
6
#' @details Contains multiple somewhat redundant functions for searching park units including unit codes, names, states, regions, networks, regions, etc.
7
7
#' These functions can be handy if you need to supply the unit code when downloading data but only know the park name, if you have a unit code but don't know what park, region, etc it refers to, or if you want to know all the parks that are within a given network, region, or state (note: it will actually supply all park units, not just National Parks).
@@ -11,7 +11,7 @@
11
11
#'
12
12
#' @importFrom magrittr %>%
13
13
#'
14
-
#' @return one data frame to the global environment. May contain multiple matches. Sufficient detail should be provided to choose the appropriate UnitCode for use with other NPSutils functions such as get.parkTaxonReferences (in get.referenceInfo.R).
14
+
#' @return one data frame to the global environment. May contain multiple matches.
15
15
#'
16
16
#' @export
17
17
#' @examples
@@ -22,53 +22,55 @@ get_unit_code <- function(unit) { # input must have quotes to indicate strings
22
22
# To do:
23
23
# Warnings and checks on parameter inputs are not yet implemented.
24
24
# The output dataframe is a little unwieldy and could be cleaned up.
25
-
26
-
27
-
# It is worth figuring out how stable the URL is: when were the data last updated? How frequently are they updated? Are field codes ever changed, or just data added? Do updates entail a new URL?
25
+
28
26
f<- file.path(tempdir(), "irmadownload.xml")
29
27
if (!file.exists(f)) {
30
-
curl::curl_download("https://irmaservices.nps.gov/v2/rest/unit/", f) # access all park codes from NPS xml file
31
-
# curl::curl_download(paste0("https://irmaservices.nps.gov/v2/rest/unit/",Unit, f)) #doesn't work
32
-
# curl::curl_download(paste0("https://irmaservices.nps.gov/v2/rest/unit/", Unit,""), f) #works but requires removing preceding if(!file.exists(f))
33
-
print("file downloaded") # check for download; remove when dev phase over
#' @description \code{get_park_code} is identical to \code{get_unit_code} except output is restricted to just National Parks (as opposed to including networks, etc.).Accesses info from irmaservices.nps.gov. Search for park or park unit with any string and return all applicable national park unitCodes. Handy for use with get.dataPackage if you don't know a Park's UnitCode.
43
+
#' @description `get_park_code` is identical to `get_unit_code` except the output is restricted to just National Parks (as opposed to including networks, etc.).Accesses info from irmaservices.nps.gov. Search for park or park unit with any string and return all applicable national park unitCodes.
46
44
#'
47
45
#' @param park is a case-insensitive string containing some part of the unit's FullName, e.g "Yellow".
48
46
#'
49
-
#' @return one data frame to the global environment. May contain multiple matches. Sufficient detail should be provided to choose the appropriate UnitCode for use with other NPSutils functions such as get.parkTaxonReferences (in ReferenceInfo.R). Dataframe contains UnitCode, FullName, UnitLifeCycle, Network, Region, and StateCodes.
47
+
#' @return one data frame to the global environment. May contain multiple matches.
50
48
#'
51
49
#' @export
52
50
#' @examples
53
51
#' \dontrun{
54
52
#' get_park_code("Yellow")
55
53
#' }
56
-
get_park_code<-function(park) { # case-insensitive string (in quotes) containing some part of the unit's FullName
54
+
get_park_code<-function(park) {
57
55
f<- file.path(tempdir(), "irmadownload.xml")
58
56
if (!file.exists(f)) {
59
-
curl::curl_download("https://irmaservices.nps.gov/v2/rest/unit/", f) # access all park codes from NPS xml file
#' @description \code{get_unit_code_info} accesses info from irmaservices.nps.gov and allows you to search a Park Unit Code and determine which park, network, or other entity it is associated with along with ancillary information.
73
+
#' @description `get_unit_code_info` accesses info from irmaservices.nps.gov and allows you to search a Park Unit Code and determine which park, network, or other entity it is associated with along with ancillary information.
72
74
#'
73
75
#' @param code is a case-insensitive string. It typically is 4 letters long and typically does not include numbers but may be longer, shorter, or include special characters such as "-", e.g. "SFCN".
#' Search irmaservices.nps using any piece of information.
96
102
#'
97
-
#' @description \code{get_unit_info} accesses info from irmaservices.nps.gov and allows you to search a Park Unit based on any number or combination of parameters. Not all parameters need to be specified, but it is probably worth specifying which parameters ARE specified, e.g. get.unitInfo(LifeCycle="Inactive"). If the arguments are not specified, they will default to the order supplied in the function.
103
+
#' @description `get_unit_info` accesses info from irmaservices.nps.gov and allows you to search a Park Unit based on any number or combination of parameters. Not all parameters need to be specified, but it is probably worth specifying which parameters ARE specified, e.g. get.unitInfo(LifeCycle="Inactive"). If the arguments are not specified, they will default to the order supplied in the function.
98
104
#'
99
105
#' @param code defaults to NULL. Is a case-insensitive string. It typically is 4 letters long and typically does not include numbers but may be longer, shorter, or include special characters such as "-".
100
106
#' @param park defaults to NULL. Is a case-insensitive string. It will search for any subset of the FullName or parks or park units
0 commit comments