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

What's the status on this? Still seeing this problem and the workaround to revert to 1.2.1 isn't working for me.

jeffrey-parmet avatar Apr 04 '24 20:04 jeffrey-parmet

I am also curious what the status of this PR is, as I run into this issue daily.

joranE avatar Apr 15 '24 18:04 joranE

If you're in need of this PR now, you can use pak::pak("https://github.com/r-lib/scales/pull/420") to install it.

teunbrand avatar Apr 15 '24 18:04 teunbrand

I'm still seeing this error when I try scale_y_continuous(labels=scales::label_number(scale_cut = cut_short_scale())). I can't go back to 1.2.1 and I tried the suggestion by teunbrand to no success

markram4 avatar Jun 03 '24 18:06 markram4

I am still running into this same issue.

Thanks to @teunbrand for the fix! It works for me.

slowkow avatar Aug 13 '24 01:08 slowkow

Please pass on any and all thanks to Colin, I'm just the middleperson giving installation hints :)

teunbrand avatar Aug 13 '24 04:08 teunbrand

I'm still seeing this error when I try scale_y_continuous(labels=scales::label_number(scale_cut = cut_short_scale())). I can't go back to 1.2.1 and I tried the suggestion by teunbrand to no success

Also not fixed for me when installing from this PR.

MarkMc1089 avatar Sep 17 '24 15:09 MarkMc1089