Skip to content

Introduce MizerRate S3 class for rate function outputs#332

Merged
gustavdelius merged 9 commits intomasterfrom
MizerArray-class
Apr 9, 2026
Merged

Introduce MizerRate S3 class for rate function outputs#332
gustavdelius merged 9 commits intomasterfrom
MizerArray-class

Conversation

@gustavdelius
Copy link
Copy Markdown
Member

@gustavdelius gustavdelius commented Apr 9, 2026

Summary

  • Introduces the MizerRate S3 class, a lightweight wrapper around species × size matrices returned by rate functions (getEncounter(), getFeedingLevel(), getMort(), getEGrowth(), getFMort(), etc.). It carries rate_name and units attributes and provides enhanced print(), summary(), plot(), and as.data.frame() methods while behaving transparently as a plain matrix for arithmetic and subsetting.
  • Centralises dimnames assignment for MizerRate objects inside the constructor.
  • Updates all @return tags for get* rate functions in R/rate_functions.R to reflect that they now return a MizerRate object.
  • Adds MizerRate and is.MizerRate to the Classes section of the pkgdown reference index.
  • Adds a ## The MizerRate class section to vignettes/developer_vignette.Rmd.
  • Adds a ## Plotting rate functions section to vignettes/plotting.Rmd demonstrating plot() and as.data.frame() on MizerRate objects.
  • Fixes two test failures in tests/testthat/test-project_methods.R caused by MizerRate attribute propagation.

Test plan

  • devtools::test() passes with no failures
  • devtools::check() passes with no errors or warnings
  • devtools::document() regenerates man pages cleanly
  • plot(getEncounter(NS_params), NS_params) produces a correctly coloured line plot
  • summary(getFeedingLevel(NS_params)) prints a per-species table

🤖 Generated with Claude Code

@gustavdelius gustavdelius merged commit 724621c into master Apr 9, 2026
1 check failed
@gustavdelius gustavdelius deleted the MizerArray-class branch April 9, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant