Skip to content

Commit

Permalink
Removed hardcoded path references
Browse files Browse the repository at this point in the history
  • Loading branch information
gambler1650 committed May 23, 2024
1 parent 391df7d commit 4cbbbdf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions R/get_thresholds_survdat_atlantis.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use pulled survdat.rds file to get environmental thresholds for Atlantis groups
library(dplyr)
library(here)


survdat_dt <- readRDS("C:/Users/robert.gamble/Desktop/Env_Thresholds/SurvDat/surveyPull.rds")

survdat_dt <-readRDS(here("data","surveyPull.rds"))
summary_table <- group_by(survdat_dt$survdat,SVSPP,SEASON)
summary_table_SEASON <- summarise(summary_table, min_bottom_temp = min(BOTTEMP, na.rm=T), max_bottom_temp = max(BOTTEMP, na.rm=T),
min_surface_temp = min(SURFTEMP,na.rm=T), max_surface_temp = max(SURFTEMP,na.rm=T),
Expand All @@ -15,7 +15,8 @@ summary_table_SPECIES <- summarise(summary_table_SPECIES, min_bottom_temp = min(
min_bottom_sal = min(BOTSALIN,na.rm=T), max_bottom_sal = max(BOTSALIN,na.rm=T),
min_surface_sal = min(SURFSALIN,na.rm=T), max_surface_sal = max(SURFSALIN,na.rm=T))

atlantis_groups <- read.csv("C:/Users/robert.gamble/Desktop/Env_Thresholds/SurvDat/atlantis_codes_svspp_survey_thresholds.csv")
atlantis_groups <- read.csv(here("inputs","atlantis_codes_svspp_survey_thresholds.csv"))

atlantis_group_table <- group_by(atlantis_groups,Code)
combined_table_SEASON <- full_join(summary_table_SEASON, atlantis_group_table)
combined_table_SEASON <- filter(combined_table_SEASON, !is.na(Code))
Expand Down Expand Up @@ -49,5 +50,5 @@ summary_table_ATLANTIS_SPECIES$max_bottom_sal[(summary_table_ATLANTIS_SPECIES$ma
summary_table_ATLANTIS_SPECIES$min_surface_sal[(summary_table_ATLANTIS_SPECIES$min_surface_sal == 'Inf') | (summary_table_ATLANTIS_SPECIES$min_surface_sal == '-Inf')] <- 'NA'
summary_table_ATLANTIS_SPECIES$max_surface_sal[(summary_table_ATLANTIS_SPECIES$max_surface_sal == 'Inf') | (summary_table_ATLANTIS_SPECIES$max_surface_sal == '-Inf')] <- 'NA'

write.csv(summary_table_ATLANTIS_SEASON,"C:/Users/robert.gamble/Desktop/Env_Thresholds/SurvDat/atlantis_seasonal_thresholds.csv",row.names=FALSE)
write.csv(summary_table_ATLANTIS_SPECIES,"C:/Users/robert.gamble/Desktop/Env_Thresholds/SurvDat/atlantis_group_thresholds.csv",row.names=FALSE)
write.csv(summary_table_ATLANTIS_SEASON,here("thresholds","atlantis_seasonal_thresholds.csv"),row.names=FALSE)
write.csv(summary_table_ATLANTIS_SPECIES,here("thresholds","atlantis_group_thresholds.csv"),row.names=FALSE)

0 comments on commit 4cbbbdf

Please sign in to comment.