Keep the given_species_params class in record_given_species_params() - #472
Open
gustavdelius wants to merge 1 commit into
Open
Keep the given_species_params class in record_given_species_params()#472gustavdelius wants to merge 1 commit into
gustavdelius wants to merge 1 commit into
Conversation
New columns were added with `cbind()`, which returns a plain data frame and so stripped the `given_species_params`/`species_params` class from the result. Without the class, `$.species_params` no longer applies and `given_species_params(params)$w_mat` comes back without the species names that `species_params(params)$w_mat` carries. `species_params<-()` did not show this because the `setParams()` call at the end of the method restores the class. The bug only became reachable when the recording step was exported for standalone use. Assign the new columns one at a time instead, which preserves the class and the row names. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #471.
record_given_species_params()added wholly new columns withcbind(), which returns a plain data frame and so stripped thegiven_species_params/species_paramsclass from the result. Without the class,$.species_paramsno longer applies, andcomes back without the species names that
species_params(params)$w_matcarries — an inconsistency between the two accessors that should not exist.species_params<-()never showed this, because thesetParams()call at the end of the method restores the class. The bug only became reachable when the recording step was exported for standalone use, and it showed up immediately inmizerEcopath: aftersetFeedingLevels()recorded its newhandks,given_species_params(params)$hwas unnamed whilespecies_params(params)$hwas named.The fix assigns the new columns one at a time, which preserves both the class and the row names.
Regression test covers the class, the row names and the naming done by
$, with and without a new column. Full suite: 3370 pass, 0 fail.🤖 Generated with Claude Code