Skip to content

Commit

Permalink
fix(Table_for_SS3): Finds appropriate columns in indexdata
Browse files Browse the repository at this point in the history
Changes to VAST and FishStatsUtils that create the file
Index rather than Table_for_SS3 led to column name changes.
These legacy columns are easily recreated and saved similar to
the old table in Table_for_SS3.csv to allow downstream code to work.
This change was discussed in #39 with great changes made by
@chantelwetzel-noaa but we decided to go with the simpler change here
rather than changing the column names of everything in VASTWestCoast
which would also lead to code changes that would be needed for
assessment purposes.
  • Loading branch information
kellijohnson-NOAA committed Apr 15, 2022
1 parent 6834506 commit cb722e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/VAST_do.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,14 @@ VAST_do <- function(Database, settings, conditiondir, compiledir,
parameter_estimates = out$parameter_estimates,
savedir = conditiondir)
fileindex <- file.path(conditiondir, "Table_for_SS3.csv")
indexdata <- utils::read.csv(fileindex)
indexdata[,"Year"] <- out$year_labels[indexdata[,"Year"]]
indexdata <- data.frame(
Year = out$year_labels[index[["Table"]][, "Time"]],
Unit = index[["Table"]][, "Units"],
Fleet = index[["Table"]][, "Stratum"],
Estimate_metric_tons = index[["Table"]][, "Estimate"],
SD_log = index[["Table"]][, "Std. Error for Estimate"],
SD_mt = index[["Table"]][, "Std. Error for ln(Estimate)"]
)
utils::write.csv(x = indexdata, file = fileindex, row.names = FALSE)
plot_ss(file.in = fileindex,
lab.survey = survey,
Expand Down

0 comments on commit cb722e7

Please sign in to comment.