Skip to content

Commit

Permalink
updating tourism data
Browse files Browse the repository at this point in the history
  • Loading branch information
CarissaGervasi-NOAA committed Oct 17, 2024
1 parent dca1093 commit 8d0f481
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Report_book_files/Performance_indicators.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Indicator 30

![diving trips](/indicator_plots/prop_diving_trips_plot_final.png){fig-alt="a plot" fig-align="center"}

![Non-selective gears](/indicator_plots/Proportion of trips using non-selective gears.png){fig-alt="a plot" fig-align="center"}
![Non-selective gears](/indicator_plots/Proportion%20of%20trips%20using%20non-selective%20gears.png){fig-alt="a plot" fig-align="center"}

## 5.5 Governance

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Code to plot number of cruise ship visitors Puerto Rico & USVI
# Code to plot number of cruise ship visitors and air passengers Puerto Rico & USVI

# Last updated 6/19/2024 by Carissa Gervasi
# Last updated 10/17/2024 by Carissa Gervasi

rm(list = ls())
dev.off()


# Puerto Rico - cruise passengers

url1<-'https://www.bde.pr.gov/BDE/PREDDOCS/I_CRUISE.XLS'

library(readxl)
Expand All @@ -31,6 +33,34 @@ cruise_PR = as.numeric(df2t$V2)
PR_cruise <- data.frame(Year = yrs_PR, Cruise_passengers = cruise_PR)



# Puerto Rico - air passengers (source = PR ports authority)

url1<-'https://www.bde.pr.gov/BDE/PREDDOCS/I_CARGO.XLS'

library(readxl)
library(httr)
packageVersion("readxl")

GET(url1, write_disk(tf <- tempfile(fileext = ".xls")))
df <- read_excel(tf, 2L)
str(df)


df2 = df[c(52,63),]

df2t = as.data.frame(t(df2))

df2t = df2t[-c(1,2,12),]


yrs_PR = as.integer(df2t$V1)
air_PR = as.numeric(df2t$V2)

# Create a data frame
PR_air <- data.frame(Year = yrs_PR, Air_passengers = air_PR)


############################

#USVI
Expand Down Expand Up @@ -78,14 +108,20 @@ table_data <- strsplit(table_text, " +")[[1]]
years <- c(2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022)

# Extract and clean the total visitors data by removing commas
passengers <- gsub(",", "", table_data[87:101])
passengers <- as.numeric(passengers)
cruise_passengers <- gsub(",", "", table_data[87:101])
cruise_passengers <- as.numeric(cruise_passengers)

# Extract and clean the total visitors data by removing commas
air_passengers <- gsub(",", "", table_data[66:80])
air_passengers <- as.numeric(air_passengers)

# Create a data frame
USVI_cruise <- data.frame(Year = years, Cruise_passengers = passengers)
USVI_cruise <- data.frame(Year = years, Cruise_passengers = cruise_passengers)
USVI_air <- data.frame(Year = years, Air_passengers = air_passengers)

# Print the data frame
print(USVI_cruise)
print(USVI_air)



Expand Down
4 changes: 2 additions & 2 deletions indicator_processing/non_automated/oceanNAICS.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ save(ind, file = "indicator_objects/oceanNAICS.RData")
########################################################################################


#### ************ As of 7/5/24, can't get the API for this working. For now, will just plot the data Seann uploaded to Github. At the end of this script is some code to work with the API but it isn't yet working.
#### ************ As of 7/5/24, can't get the API for this working. For now, will just plot the data downloaded from the data portal. At the end of this script is some code to work with the API but it isn't yet working.

rm(list = ls())
dev.off()
Expand Down Expand Up @@ -199,7 +199,7 @@ print(naics_df)
## Access the API

library(devtools)
#install_github('mikeasilva/blsAPI')
install_github('mikeasilva/blsAPI')
library(blsAPI)
library(jsonlite)

Expand Down

0 comments on commit 8d0f481

Please sign in to comment.