Skip to content

Return a numeric data frame from smoothness() on data frames - #752

Merged
jmgirard merged 1 commit into
mainfrom
hotfix-smoothness-data-frame
Nov 26, 2026
Merged

jmgirard merged 1 commit into
mainfrom
hotfix-smoothness-data-frame

Conversation

@jmgirard

Copy link
Copy Markdown
Contributor

Without iterations, smoothness() on a data frame returned a character matrix, because cbind() joined the Parameter names with the values. as.numeric() on the result then gave the names mixed with the values as text:

as.numeric(smoothness(BOD))
#> [1] "Time"   "demand"   "0.986393923832144"   "0.406270770677043"

With iterations, the same method already returned a data frame with Parameter, Smoothness and SE, and as.numeric.datawizard_smoothness() reads x$Smoothness. This makes the path without iterations return the same shape, a data frame with Parameter and Smoothness.

The smoothness.md snapshot changes from the character matrix to that data frame, with the same values. The class test for smoothness(BOD) changes from matrix/array to data.frame.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain, and the changes, tests, snapshots, and documentation consistently address the corrected smoothness return type and numeric behavior.

No open issues 🎉

What changed in this PR

This PR fixes smoothness() for data-frame inputs without bootstrapping so it returns a structured numeric data frame consistent with the bootstrapped path and compatible with as.numeric().

Changes:

  • Normalize non-bootstrapped smoothness results into a data frame.
  • Update tests and snapshots for the new return type and numeric values.
  • Document the behavior correction in NEWS.md.
File Description
tests/​testthat/​test-smoothness.R Updates tests to verify the data-frame output class, parameter names, and numeric smoothness values.
tests/​testthat/​_snaps/​smoothness.md Updates the snapshot from the character matrix output to the numeric data-frame output.
R/​smoothness.R Normalizes non-bootstrapped per-column results into data frames before combining them.
NEWS.md Documents the corrected return shape and numeric conversion behavior.

Review effort: Lite

@jmgirard
jmgirard force-pushed the hotfix-smoothness-data-frame branch from 76451fd to c6aabcb Compare November 26, 2026 00:40
@jmgirard
jmgirard merged commit 033c62a into main Nov 26, 2026
25 of 27 checks passed
@jmgirard
jmgirard deleted the hotfix-smoothness-data-frame branch November 26, 2026 14:55
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.

3 participants