Skip to content

Compute Dominance levels from input data#152

Merged
sbuis merged 2 commits into
mainfrom
feat/dominance-levels-from-data
Feb 26, 2026
Merged

Compute Dominance levels from input data#152
sbuis merged 2 commits into
mainfrom
feat/dominance-levels-from-data

Conversation

@sbuis
Copy link
Copy Markdown
Member

@sbuis sbuis commented Feb 26, 2026

Summary

This PR updates CroPlotR to handle the 'Dominance' column from input data instead of using hard-coded levels.

Changes

  • Levels of the 'Dominance' column are now derived from the input data frames sim and obs.
  • If the 'Dominance' column is absent or contains NA values, these are replaced with the hard-coded value "Single Crop".
  • Removes previous hard-coded levels from the code, making the package more flexible for new usages.

Benefits

  • More flexible handling of the 'Dominance' column: users can now define the levels they want in their data, rather than being restricted to "Principal" and "Associated".
  • Preserves backward compatibility for datasets without a 'Dominance' column by defaulting to "Single Crop".

…hard coded

- Levels of the 'Dominance' column are now derived from the input data frames `sim` and `obs`.
- If 'Dominance' is absent or contains NA values, these are replaced by the hard-coded value "Single Crop".
Add conditional checks in `format_cropr` so `sim$Dominance`, `obs$Dominance`, and `obs_sd$Dominance` are only converted to factors if not already. This ensures existing factor levels and their order are preserved, preventing unnecessary warnings and unintended changes.
@sbuis sbuis merged commit d4d0550 into main Feb 26, 2026
12 of 13 checks passed
@sbuis sbuis deleted the feat/dominance-levels-from-data branch February 26, 2026 13:05
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