Better decimal formatting
Makes sure that pillar formats decimals according to the decimal mark defined by the user with the OutDec option (as described in help("options")).
I was in doubt whether I should have added any sort of validation to OutDec. I initially wrote it to default to . in EN locales and , in certain European locales, and to accept the OutDec value only if it was a character and length 1. I figured the length was especially important given how pillar deals with screen width. I assumed base would also have such checks. However, out of curiosity I set OutDec to "potato" to see how the base print function would deal with it, and indeed it printed 0.1 as [1] 0potato1. Why should I take that away from users?
So, I didn't add the length requirement, but I imagine you would like to do that, as well as add some sort of type validation. Regardless, the important thing is that pillar respects the OutDecoption.
Best regards.
Thanks.
@hadley: Should our printing depend on getOption("OutDec") ?
Hmmm, this seems like a change with potentially unexpected consequences, so we’d need to carefully analyse to know whether or not it’s worth.