Commit f3b445f
authored
Say something when a formula string is written as text (#147)
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.1 parent a948bd7 commit f3b445f
2 files changed
Lines changed: 45 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
| 467 | + | |
467 | 468 | | |
468 | 469 | | |
469 | 470 | | |
| |||
474 | 475 | | |
475 | 476 | | |
476 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
477 | 498 | | |
478 | 499 | | |
479 | 500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
126 | | - | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
0 commit comments