PIFSCstockassessments / ss3diags

R package with advanced diagnostics to evaluate a Stock Synthesis model. Diagnostics include residual analyses, hindcasting and cross-validation techniques, and retrospective analyses.
http://pifscstockassessments.github.io/ss3diags/
2 stars 4 forks source link

Code Styler Issues (dollar operator conversion) with season error message #33

Closed efletcherPIFSC closed 2 years ago

efletcherPIFSC commented 2 years ago

gh4actions call-docs-and-styler error styling SSmase.R andSSplotHCxval.R` converting dollar operators to brackets.

Status  Count   Legend 
1: When processing R/SSmase.R: <text>:149:89: unexpected symbol
148:       Season <- as.numeric(Season)[1]
149:       if (is.na(Season)) stop("Season must a default or and or the integer of indices[["Seas
                                                                                             ^ 
2: When processing R/SSplotHCxval.R: <text>:[41](https://github.com/PIFSCstockassessments/ss3diags/runs/6186033932?check_suite_focus=true#step:13:41)4:89: unexpected symbol
413:       Season <- as.numeric(Season)[1]
414:       if (is.na(Season)) stop("Season must a default or and or the integer of indices[["Seas
                                                                                             ^ 
Error: Error: styler threw an error
Execution halted
✔   22  File unchanged.
ℹ   0   File changed.
✖   2   Styling threw an error.
────────────────────────────────────────
Error: Process completed with exit code 1.

SSmase.R and SSPlotHCxval.R throws this error message if a non-default Season value is NA (or a non-integer): stop("Season must a default or and or the integer of indices$Seas 1,2,3,4")

https://github.com/PIFSCstockassessments/ss3diags/blob/8c76cf069e7985d7b9d60c92d18961757bfb90a2/R/SSmase.R#L147-L150

https://github.com/PIFSCstockassessments/ss3diags/blob/8c76cf069e7985d7b9d60c92d18961757bfb90a2/R/SSplotHCxval.R#L412-L415

Converting indices$Seas to indices[[Seas]] manually is no problem.

My other question is there a less ambiguous way to say: Season must a default or and or the integer of indices$Seas 1,2,3,4.

Resolution

  1. Manually renaming indices$Seas -> indices[[Seas]]
  2. Replace the error message to "Season must be "default" or an integer value of a season included in the index data (ie 1,2,3,4)" .
MOshima-PIFSC commented 2 years ago

@efletcherPIFSC what do you think about changing that line to say "Season must be "default" or an integer value of a season included in the index data (ie 1,2,3,4)."?

efletcherPIFSC commented 2 years ago

I agree to the that.idea.

One more question, We assuming that the index's integer values of a season is limited to (1,2,3,4) or to any numerical.

MOshima-PIFSC commented 2 years ago

I think its limited to 1-4 because it assumes 4 seasons a year (winter, spring, summer, fall).