[feat]: compatability of r4ss::ss_output object into convert_output#288
[feat]: compatability of r4ss::ss_output object into convert_output#288Schiano-NOAA wants to merge 18 commits into
r4ss::ss_output object into convert_output#288Conversation
New version checklist
|
Code Metrics Report
Code coverage of files in pull request scope (47.6%)
Reported by octocov |
…to apply similar logic
…f before manipulation; add missing grouping to keep consistent bewteen r4ss and report file
…r suggestion from dplyr:" This reverts commit 00e0f16.
|
Remaining todo:
|
r4ss::ss_output object into convert_outputr4ss::ss_output object into convert_output
…g the package for test
There was a problem hiding this comment.
Pull request overview
This PR extends convert_output() to accept an r4ss::ss_output (list-like) object in addition to file-path inputs, and adds a regression test plus variable-name mappings to support this new input path.
Changes:
- Add support for
r4ss::ss_output-style list inputs to be processed as SS3 output. - Add a test fixture-based check that
convert_output()can run on an r4ss object without error. - Extend
ss3_var_names.csvwith additional label mappings for SS3/r4ss-derived fields.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
R/convert_output.R |
Adds SS3 handling for list inputs (r4ss output) and adjusts parsing/normalization paths. |
tests/testthat/test-convert_output.R |
Adds a new test that exercises convert_output() with an r4ss object fixture. |
inst/resources/ss3_var_names.csv |
Adds/updates SS3 variable name mappings to support additional labels. |
Comments suppressed due to low confidence (1)
R/convert_output.R:540
grepl("?_month_[0-9]_?", ...)/grepl("?_area_[0-9]_?", ...)start with?, which is an invalid regex ("nothing to repeat") in R. This can emit warnings or fail label normalization; the intended optional underscore should be expressed as_?.
label = dplyr::case_when(
grepl("?_month_[0-9]_?", label) ~ stringr::str_replace(label, "_?month_\\d?", ""),
grepl("?_area_[0-9]_?", label) ~ stringr::str_replace(label, "_?area_\\d?", ""),
TRUE ~ stringr::str_extract(label, "^.*?(?=_\\d|_gp|_fem|_mal|_sx|:|$)")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Schiano-NOAA I see your checklist above isn't fully checked-off. Still ready for a review? |
|
@sbreitbart-NOAA oh thanks! Let me add a check for the version, otherwise feel free to review. I'm fairly confident this will work for all models. |
|
@sbreitbart-NOAA good to go for review! I think all is well here |
sbreitbart-NOAA
left a comment
There was a problem hiding this comment.
Most testing works well and quickly! Two plots don't work with the r4ss sample data, though: plot_abundance_at_age() and plot_biomass_at_age(). Both give this error:
plot_abundance_at_age(r4_out)
! Multiple module names found in data.
ℹ Selection bypassed. Filtering by recruit.
Error in `column_data[[1]]` at stockplotr/R/process_data.R:305:5:
! Can't extract columns past the end.
ℹ Location 1 doesn't exist.
ℹ There are only 0 columns.
Run `rlang::last_trace()` to see where the error occurred.
|
@sbreitbart-NOAA thanks for looking at this! I will see what is going on and make adjustments 👍 |
This feature adds another functionality to allow users to input the "converted" output from a stock synthesis model that is run through the function
ss_outputin {r4ss}. This provides users multiple ways to convert the output for a stock synthesis model in the case they only have one or the other.