Skip to content

Say something when a formula string is written as text - #147

Merged
billdenney merged 1 commit into
masterfrom
claude/warn-formula-as-text
Aug 5, 2026
Merged

Say something when a formula string is written as text#147
billdenney merged 1 commit into
masterfrom
claude/warn-formula-as-text

Conversation

@billdenney

Copy link
Copy Markdown
Collaborator

A cell column has no column-wide "these are all formulas", so

df[i, j] <- "=SUM(A1:A2)"

writes those characters. That is the documented rule and it stays, but it is a quiet way to lose every formula on a sheet: run unpatched against this writexl, BioMonTools produces a workbook whose NOTES sheet has 0 formula cells and 20 inert HYPERLINK strings, and nothing -- not R, not R CMD check, not CRAN's reverse-dependency run -- says a word. The file opens, so the check passes.

The assignment now warns and names the spelling that works. Nothing about what gets written changes.

Scoped to assignment, where the ambiguity is. Measured:

d[i, j] <- "=SUM(A1)" warns
d[i, j] <- "plain text" silent
d[i, j] <- 99 silent
d[i, j] <- NA silent
d[i, j] <- xl_formula("=SUM(A1)") silent
xl_cell_general(value = "=SUM(A1)") silent

The last is deliberate: constructing a text cell that looks like a formula is documented behaviour, and it is not the assignment path's business to second-guess a constructor.

Unpatched BioMonTools now raises 50-odd warnings where it raised none. It is still worth patching -- the warning tells you the formulas are gone, it does not put them back.

A cell column has no column-wide "these are all formulas", so

  df[i, j] <- "=SUM(A1:A2)"

writes those characters.  That is the documented rule and it stays, but it is a
quiet way to lose every formula on a sheet: run unpatched against this writexl,
BioMonTools produces a workbook whose NOTES sheet has 0 formula cells and 20
inert HYPERLINK strings, and nothing -- not R, not R CMD check, not CRAN's
reverse-dependency run -- says a word.  The file opens, so the check passes.

The assignment now warns and names the spelling that works.  Nothing about what
gets written changes.

Scoped to assignment, where the ambiguity is.  Measured:

  d[i, j] <- "=SUM(A1)"              warns
  d[i, j] <- "plain text"            silent
  d[i, j] <- 99                      silent
  d[i, j] <- NA                      silent
  d[i, j] <- xl_formula("=SUM(A1)")  silent
  xl_cell_general(value = "=SUM(A1)") silent

The last is deliberate: constructing a text cell that looks like a formula is
documented behaviour, and it is not the assignment path's business to
second-guess a constructor.

Unpatched BioMonTools now raises 50-odd warnings where it raised none.  It is
still worth patching -- the warning tells you the formulas are gone, it does not
put them back.
@billdenney
billdenney merged commit f3b445f into master Aug 5, 2026
12 checks passed
@billdenney
billdenney deleted the claude/warn-formula-as-text branch August 5, 2026 11:03
billdenney added a commit that referenced this pull request Aug 5, 2026
Brings in the warning when a formula string is assigned into a cell column and
written as text (#147), which the Breaking changes entry describes.
billdenney added a commit that referenced this pull request Aug 5, 2026
#147 added the warning; the Breaking changes entry described the behaviour
without it.  The character count was wrong too -- "=SUM(A1:A2)" is eleven, not
eight.
billdenney added a commit that referenced this pull request Aug 5, 2026
* Prepare 2.0.0

Version 1.5.4.9000 -> 2.0.0 in DESCRIPTION, in the NEWS heading, and in the
README line recording what the benchmark was measured on.

The major number is not decoration.  Four changes in this cycle alter what an
existing script writes -- POSIXct time zones, Date before 1900-03-01, columns of
an unrepresentable type now erroring rather than warning, and sheet-name repair
truncating at a genuine 31 characters -- plus the xl_hyperlink(name =)
deprecation.  They were scattered through New features and Bug fixes, where a
reader upgrading would have had to find them; NEWS now opens with a Breaking
changes section that collects them, and the entries are removed from the
sections below rather than repeated.

cran-comments.md records the maintainer change from Jeroen Ooms to Bill Denney,
why the version is 2.0.0, the environments checked, and the reverse-dependency
result.  It was already in .Rbuildignore, so it does not reach the tarball.

R CMD check --as-cran, which is what a release wants rather than a plain check,
turned up two scratch .rds files a revdep helper script had left at top level.
Removed, and .gitignore now covers them alongside the lintr one.

* As submitted to CRAN

* Note the formula-column change, and drop the stale submission record

The cell-vector rewrite that just landed on master removes the error BioMonTools
hit, but not the reason it was writing formulas in the first place: a cell
column carries no column-wide "these are all formulas", so a row assignment of
a string writes a string.  That is a real difference from 1.5.4, where
xl_formula() returned a classed character vector and the class survived the
assignment, so it belongs with the other breaking changes rather than in a note
about internals.

CRAN-SUBMISSION recorded the tarball built from 67fa54b, which the merge has
now superseded.  Leaving it would have it describe a commit that is no longer
what 2.0.0 is.  Its .Rbuildignore entry stays, since the next submission writes
the file again.

* Say that the formula-as-text assignment warns

#147 added the warning; the Breaking changes entry described the behaviour
without it.  The character count was wrong too -- "=SUM(A1:A2)" is eleven, not
eight.

* Rewrite cran-comments as a resubmission

The previous text told CRAN that all 135 reverse dependencies had been checked
against this version with no change in result.  Their pretest found otherwise,
and the run behind that sentence predates both changes made since, so the claim
was no longer true of these sources.

It now says what was actually done: the full run, when it was made and what it
therefore does not cover, and the individual re-check of the package the pretest
flagged.  The two changes that address the failure are described, along with
BioMonTools 1.3.2 having adopted the working spelling upstream.

The formula-as-text change is added to the list justifying the major version.
It was missing, which is how it reached a reverse dependency unannounced.

* Record that the maintainer change is already confirmed

Jeroen Ooms emailed CRAN during the previous submission and CRAN acknowledged
it, so the resubmission does not leave that outstanding.

* Simplify comments

* As submitted to CRAN

* On CRAN
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