Skip to content

cd_summary(): trends from several trend_start values differ only by Years #106

Description

@NewGraphEnvironment

If we do it: a cd_summary() table over cd_trend(x, trend_start = c(1951, 1981)) says which row is which window. If we never do: two rows read Mean temperature / Annual with different slopes, told apart only by Years, which a reader has to subtract from the current year to decode.

Problem

cd_trend() accepts several trend_start values (R/cd_trend.R), and cd_summary() drops trend_start. The rows keep Years (n_years), which varies with the start, but nothing names the window. Same family as #98: #98 kept stations apart ( (variable) suffix) and raw vs anomaly trends apart (a conditional Trend on column).

Proposed Solution

Carry the start the way #98 carries the scale: a Start (or Window) column added only when the table holds more than one trend_start, so single-window tables keep their shape.

As built (PR #109): Start, not Window. It holds the start year that was asked of cd_trend(). A Window column would need an end year, which the trend table does not carry, and trend_start + n_years - 1 is wrong when a series has gaps. The column follows Period, or Trend on when that is present. It is decided over the whole table, and an NA start counts as a window of its own. Both vignettes had shown this bug, with 59 look-alike row pairs each. Their hidden trend-table chunk now also orders rows so each 1951/1981 pair sits on adjacent rows.

Found by the plan review for #98.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions