Skip to content

Commit 1567a8c

Browse files
authored
Merge pull request #148 from SpatialPlanning/devel
Devel
2 parents a40de93 + 2f65166 commit 1567a8c

File tree

245 files changed

+11623
-2222
lines changed

Some content is hidden

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

245 files changed

+11623
-2222
lines changed

.github/workflows/MacOS.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
any::rcmdcheck
4747
any::remotes
4848
any::lpsymphony
49+
any::slam
4950
needs: check
5051

5152
- uses: r-lib/actions/check-r-package@v2

.github/workflows/Ubuntu.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
any::rcmdcheck
5454
any::remotes
5555
any::lpsymphony
56+
any::slam
5657
needs: check
5758

5859
- uses: r-lib/actions/check-r-package@v2

.github/workflows/Windows.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
any::rcmdcheck
5151
any::remotes
5252
any::lpsymphony
53+
any::slam
5354
needs: check
5455

5556
- uses: r-lib/actions/check-r-package@v2

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
any::rcmdcheck
4343
any::remotes
4444
any::lpsymphony
45+
any::slam
4546
needs: coverage
4647

4748
- name: Test coverage

NAMESPACE

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,16 @@ importFrom(dplyr,summarise)
6868
importFrom(dplyr,summarize)
6969
importFrom(dplyr,tibble)
7070
importFrom(dplyr,ungroup)
71-
importFrom(forcats,fct_relevel)
7271
importFrom(ggnewscale,new_scale_colour)
7372
importFrom(ggnewscale,new_scale_fill)
7473
importFrom(ggplot2,aes)
75-
importFrom(ggplot2,after_stat)
7674
importFrom(ggplot2,annotate)
7775
importFrom(ggplot2,coord_polar)
7876
importFrom(ggplot2,coord_sf)
7977
importFrom(ggplot2,element_blank)
8078
importFrom(ggplot2,element_line)
8179
importFrom(ggplot2,element_rect)
8280
importFrom(ggplot2,element_text)
83-
importFrom(ggplot2,expansion)
8481
importFrom(ggplot2,geom_abline)
8582
importFrom(ggplot2,geom_bar)
8683
importFrom(ggplot2,geom_segment)

R/data.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Planning Units
22
#'
3-
#' An sf dataframe of planning units for spatial prioritisation
3+
#' An sf dataframe of Planning Units for spatial prioritization
44
#'
55
#' @format `dat_PUs`
66
#' A data frame with XXXX rows and XXX columns:
@@ -14,9 +14,9 @@
1414

1515
# -------------------------------------------------------------------------
1616

17-
#' Boundary of planning units
17+
#' Boundary of Planning Units
1818
#'
19-
#' An sf dataframe of planning units for spatial prioritisation
19+
#' An sf dataframe of Planning Units for spatial prioritization
2020
#'
2121
#' @format `dat_bndry`
2222
#' A data frame with XXXX rows and XXX columns:
@@ -32,7 +32,7 @@
3232

3333
#' Regionalisation
3434
#'
35-
#' An sf dataframe of planning units for spatial prioritisation
35+
#' An sf dataframe of Planning Units for spatial prioritization
3636
#'
3737
#' @format `dat_region`
3838
#' A data frame with XXXX rows and XXX columns:
@@ -47,7 +47,7 @@
4747

4848
#' Binary Species Data
4949
#'
50-
#' An sf dataframe of planning units for spatial prioritisation
50+
#' An sf dataframe of Planning Units for spatial prioritization
5151
#'
5252
#' @format `dat_species_bin`
5353
#' A data frame with XXXX rows and XXX columns:
@@ -63,7 +63,7 @@
6363

6464
#' Binary Species Data 2
6565
#'
66-
#' An sf dataframe of planning units for spatial prioritisation
66+
#' An sf dataframe of Planning Units for spatial prioritization
6767
#'
6868
#' @format `dat_species_bin2`
6969
#' A data frame with XXXX rows and XXX columns:
@@ -79,7 +79,7 @@
7979

8080
#' Probability Species Data
8181
#'
82-
#' An sf dataframe of planning units for spatial prioritisation
82+
#' An sf dataframe of Planning Units for spatial prioritization
8383
#'
8484
#' @format `dat_species_prob`
8585
#' A data frame with XXXX rows and XXX columns:
@@ -93,9 +93,9 @@
9393

9494
# -------------------------------------------------------------------------
9595

96-
#' MPA Data
96+
#' Marine Protected Areas (MPAs) Data
9797
#'
98-
#' An sf dataframe of planning units for spatial prioritisation
98+
#' An sf dataframe of Planning Units for spatial prioritization
9999
#'
100100
#' @format `dat_mpas`
101101
#' A data frame with XXXX rows and XXX columns:
@@ -117,7 +117,7 @@
117117
#' @format `dat_category`
118118
#' A data frame with XXXX rows and XXX columns:
119119
#' \describe{
120-
#' \item{feature}{all features available for spatial prioritisation}
120+
#' \item{feature}{all features available for spatial prioritization}
121121
#' \item{category}{the categories of all features}
122122
#' ...
123123
#' }
@@ -135,7 +135,7 @@
135135
#' @format `dat_category2`
136136
#' A data frame with XXXX rows and XXX columns:
137137
#' \describe{
138-
#' \item{feature}{all features available for spatial prioritisation}
138+
#' \item{feature}{all features available for spatial prioritization}
139139
#' \item{category}{the categories of all features}
140140
#' ...
141141
#' }
@@ -148,7 +148,7 @@
148148

149149
#' Climate metric data
150150
#'
151-
#' An sf dataframe of planning units for spatial prioritisation
151+
#' An sf dataframe of Planning Units for spatial prioritization
152152
#'
153153
#' @format `dat_clim`
154154
#' A data frame with 780 rows and 3 columns:
@@ -179,14 +179,14 @@
179179
# -------------------------------------------------------------------------
180180

181181

182-
#' Current MPAs of the Coral Sea
182+
#' Current Marine Protected Areas (MPAs) of the Coral Sea
183183
#'
184-
#' sf file containing the current marine protected areas of the coral sea
184+
#' sf file containing the current Marine Protected Areas (MPAs) of the coral sea
185185
#'
186186
#' @format `MPAsCoralSea`
187187
#' A data frame with 397 rows and 17 columns:
188188
#' \describe{
189-
#' \item{wdpa}{binary vector denoting presence or absence of a current marine protected area}
189+
#' \item{wdpa}{binary vector denoting presence or absence of a current MPA}
190190
#' ...
191191
#' }
192192
#' @source https://www.protectedplanet.net/en/thematic-areas/wdpa?tab=WDPA

R/splnr_get_distCoast.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' @description
44
#' This function calculates the shortest distance from the centroid of each
5-
#' planning unit in an `sf` object to the nearest coastline. It can use either
5+
#' Planning Unit in an `sf` object to the nearest coastline. It can use either
66
#' a default coastline from the `rnaturalearth` package or a custom-provided
77
#' coastline `sf` object.
88
#'
@@ -13,7 +13,7 @@
1313
#' a suitable projected CRS for accurate distance calculations.
1414
#'
1515
#' @param dat_sf `[sf]` \cr An `sf` object containing polygon or point features
16-
#' representing the planning units. Must have a valid CRS.
16+
#' representing the Planning Units. Must have a valid CRS.
1717
#' @param custom_coast `[sf]` \cr An optional `sf` object representing a
1818
#' custom coastline. If `NULL` (the default), the coastline is downloaded
1919
#' from `rnaturalearth`.
@@ -99,20 +99,20 @@ splnr_get_distCoast <- function(dat_sf, custom_coast = NULL, res = "medium") {
9999
sf::st_transform(crs = sf::st_crs(dat_sf))
100100
}
101101

102-
# Calculate centroids of the planning units
103-
# Using centroids is a standard approach to represent the location of each planning unit
104-
message("Calculating centroids for planning units.")
102+
# Calculate centroids of the Planning Units
103+
# Using centroids is a standard approach to represent the location of each Planning Unit
104+
message("Calculating centroids for Planning Units.")
105105
grid_centroid <- sf::st_centroid(sf::st_geometry(dat_sf))
106106

107-
# Calculate the distance matrix between each planning unit centroid and the coastline
107+
# Calculate the distance matrix between each Planning Unit centroid and the coastline
108108
message("Calculating distances to coastline.")
109109
dist_mat <- sf::st_distance(grid_centroid, coast) %>%
110110
# Explicitly set the distance units to kilometers
111111
units::set_units("km") %>%
112112
# Drop the units class to get a numeric matrix for easier computation
113113
units::drop_units()
114114

115-
# Find the minimum distance for each planning unit (each row in the matrix)
115+
# Find the minimum distance for each Planning Unit (each row in the matrix)
116116
# This identifies the shortest distance from each centroid to any part of the coastline
117117
message("Finding minimum distances and adding to dataframe.")
118118
dat_sf$coastDistance_km <- do.call(pmin, as.data.frame(dist_mat))

0 commit comments

Comments
 (0)