cd_trend(): typed zero-row table when no series is long enough - #110
Merged
NewGraphEnvironment merged 5 commits intoSep 30, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
cd_trend() dropped every combination with fewer than 3 years, and bind_rows() of all-NULL is a 0 x 0 tibble, so cd_summary() died on "Column `period` not found" and cd_plot_timeseries() warned about uninitialised columns. Rows are now bound under a zero-row template whose key types come from the same expand.grid the rows are built from, so a factor variable stays a factor and trend_start = NULL keeps its column. slope and intercept are unnamed so empty and full results share one ptype. Fixes #101 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj
NewGraphEnvironment
deleted the
101-cd-trend-no-series-long-enough-gives-a-0
branch
September 30, 2026 18:13
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.
Summary
cd_trend()now returns a zero-row tibble with its full column set when no combination has 3+ years, instead of a shapeless 0 x 0.cd_summary()on it returns an empty table (it used to fail withColumn 'period' not found), andcd_plot_timeseries()no longer warns about uninitialised columns.expand.gridthe rows are built from, so a factorvariable/periodstays a factor andtrend_start = NULLkeeps its column.slope/interceptlose zyp's"yr"/"Intercept"names, so empty and full results share one ptype.@returnin?cd_trenddocuments the empty shape;CLAUDE.mdnotes it on the trend-table contract.Fixes #101
Related Issues
Test plan
devtools::test(): FAIL 0 | PASS 436 (the 6 warnings are pre-existing intest-cd_plot_comparison.R)devtools::check(): 0 errors. The 1 warning and 8 notes are pre-existing (noVignetteBuilder,.Rbuildignoregaps tracked in .Rbuildignore: planning/, CLAUDE.md, scripts/, data-raw/ ship in the package tarball #100 / .Rbuildignore misses planning/, scripts/, data-raw/, logs/, dev/, .claude/, CLAUDE.md - all ship in the tarball #107,.databindings, unusedsf)/code-check: 3 rounds, plus a plan review. Round 1 found the factor and NULL regressions and they were fixed; rounds 2 and 3 were clean, and round 3 checked all 11 template columns against the row builderNotes
names(trn$slope)/names(trn$intercept)are nowNULL. Nothing in the repo reads them.nrow == 0, which the 0 x 0 already satisfied. That is why this went uncaught.🤖 Generated with Claude Code
https://claude.ai/code/session_01GignjoKpZADXywTf6pAMgj