Re: [R] Formatting zeroes with prettyNum

2025-05-23 Thread Marttila Mikko via R-help
(In hindsight I should have used a `zero.print` value that looked less like a typo, e.g. `zero.print = "--"` in my example. Sorry about the potential confusion.) -Original Message- From: R-help On Behalf Of Marttila Mikko via R-help Sent: Friday, 23 May 2025 13:21 To: Howard, Tim G (DE

Re: [R] Formatting zeroes with prettyNum

2025-05-23 Thread Marttila Mikko via R-help
Tim, The purpose of the `replace.zero` argument is to allow longer replacements. See for example the behaviour with a character vector input: > prettyNum("0", zero.print = "- ", replace.zero = TRUE) [1] "- " I'm pretty sure this is a bug, and have now posted the relevant details on r-devel. A

Re: [R] Formatting zeroes with prettyNum

2025-05-23 Thread Howard, Tim G (DEC) via R-help
You fed it two characters, "dash" and "space" and it only wanted one character so it truncated to the first character and warned you that that's what it did. If you had your space before the dash, it would have used that as your replacement character > prettyNum(0, zero.print = " - ", replace =

[R] Formatting zeroes with prettyNum

2025-05-23 Thread Marttila Mikko via R-help
Dear list, Have I stumbled upon a bug, or am I holding `prettyNum()` wrong? Please see below. Best, Mikko > prettyNum(0, zero.print = "- ", replace.zero = TRUE) [1] "-" Warning message: In .format.zeros(x, zero.print, replace = replace.zero) : 'zero.print' is truncated to fit into formatted