Skip to content

Commit

Permalink
Changed protconn measurement to be total percentage protected and con…
Browse files Browse the repository at this point in the history
…nected rather than percentage of the protected area that is connected
  • Loading branch information
JoryGriffith committed Jul 17, 2024
1 parent f50a2c2 commit 957095e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/protcon_analysis/protcon_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Install necessary libraries - packages
packagesPrev<- installed.packages()[,"Package"] # Check and get a list of installed packages in this machine and R version
packagesNeed<- list("magrittr", "terra", "raster", "sf", "fasterize", "pbapply", "this.path", "rjson") # Define the list of required packages to run the script
packagesNeed<- list("magrittr", "terra", "sf", "fasterize", "pbapply", "this.path", "rjson") # Define the list of required packages to run the script
lapply(packagesNeed, function(x) { if ( ! x %in% packagesPrev ) { install.packages(x, force=T)} }) # Check and install required packages that are not previously installed

# Load libraries
Expand Down Expand Up @@ -142,8 +142,8 @@ output<- tryCatch({
#Look for the id?s in the spatial_units_periods for filter the information
areas_pa_conec = decade[decade[, "spatial_unit"] %in% pa_union,]
areas_conec = sum(areas_pa_conec[, "area_spatial"])
#Extract the percentage of area for the conected protected areas (Protcon)
protcon = (areas_conec/area_protect)*100
# Extract the percentage of total area that is protected and connected (Protcon)
protcon = (areas_conec/area_consult)*100

#Generate the area for not connected protected areas
#Identify the rows where are the connected protected areas
Expand All @@ -158,7 +158,8 @@ output<- tryCatch({

#Extract the percentage of area for the not connected protected areas (Protuncon)
areas_no_conec = (sum(areas_pa_no_conec[, "area_spatial"]))
protuncon = (areas_no_conec/area_protect)*100
protuncon = (areas_no_conec/area_consult)*100


#Create the table with the final results
#Create the row with the results for the decade i
Expand Down

0 comments on commit 957095e

Please sign in to comment.