Skip to content

Commit

Permalink
refactor(get_results_timeseries): Combines calls
Browse files Browse the repository at this point in the history
There was no need to call gsub twice, when an `|` performed the same
task for searching for brackets and colons. Now this is done in one call
to `gsub()`.
  • Loading branch information
kellijohnson-NOAA committed Apr 17, 2024
1 parent 78c5418 commit 1576816
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions R/get-results.r
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,8 @@ get_results_timeseries <- function(report.file) {
other_cols <- which(colnames(report.file$timeseries) %in%
c("Yr", "Seas", "Bio_smry", "SpawnBio", "Recruit_0"))
xx <- report.file$timeseries[, c(other_cols, catch_cols, dead_cols, F_cols)]
# remove parentheses from column names because they make the names
# non-synatic
colnames(xx) <- gsub("\\(|\\)", "", colnames(xx))
colnames(xx) <- gsub("\\:", "", colnames(xx))
# remove parentheses and colons from column names
colnames(xx) <- gsub("\\(|\\)|\\:", "", colnames(xx))
xx <- xx[xx$Yr %in% years, ]
# Get SPR from derived_quants
spr <- report.file$derived_quants[grep(
Expand Down

0 comments on commit 1576816

Please sign in to comment.