[Rd] prettyNum digits=0 not compatible with scientific notation

Robert McGehee rmcgehee @end|ng |rom w@||eyetr@d|ng@net
Thu Mar 21 21:56:19 CET 2019


R developers,
Seems I get a bad result ("%#4.0-1e" in particular) when trying to use prettyNum digits=0 with scientific notation. I tried on both my Linux box and on an online R evaluator and saw the same problem, so it's not limited to my box at least. I see the problem in both R 3.5.3 and R 3.3.2.

options(scipen=-100)
prettyNum(1, digits=0)
[1] "%#4.0-1e"
prettyNum(2, digits=0)
[1] "%#4.0-1e"
prettyNum(1, digits=0, scientific=FALSE) # Works
[1] "1"
prettyNum(1:2, digits=0) # Works
[1] "1" "2"
prettyNum(c(1.1, 2.1), digits=0)
[1] "%#4.0-1e" "%#4.0-1e"
prettyNum(c(1.1, 2.1), digits=1) # Works
[1] "1e+00" "2e+00"

> R.version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth                 



More information about the R-devel mailing list