scales icon indicating copy to clipboard operation
scales copied to clipboard

fix bug in `label_number` when `scale_cut` argument is provided (#413)

Open colindouglas opened this issue 1 year ago • 4 comments

This pull request resolves #413, implementing the fix proposed by @jbengler (link)

Behaviour in 1.3.0:

> scales::label_number(scale_cut = scales::cut_short_scale())(c(0,500,1500,2000,2500))
Error in break_suffix[bad_break][improved_break & !power10_break] <- names(lower_break[improved_break &  : 
  NAs are not allowed in subscripted assignments

Behaviour after change (as expected):

> scales::label_number(scale_cut = scales::cut_short_scale())(c(0,500,1500,2000,2500))
[1] "0"    "500"  "1.5K" "2.0K" "2.5K"

This change does not break any package tests, and I have added an additional test against this behaviour.

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 597 ]

colindouglas avatar Feb 07 '24 21:02 colindouglas