[Rd] Feature Request: Allow Underscore Separated Numbers
Gabor Grothendieck
ggrothend|eck @end|ng |rom gm@||@com
Fri Jul 15 15:12:18 CEST 2022
It would be best to simply ignore any embedded _ in numbers rather than only
accept them at fixed locations since it isn't always
a thousands separator. For example, 1 lakh is sometimes written as
1,00,000 rupees.
On Fri, Jul 15, 2022 at 7:25 AM Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>
> On 14/07/2022 3:53 p.m., Devin Marlin wrote:
> > Hello,
> >
> > After using R for a number of years, and venturing into other languages,
> > I've noticed the ones with the ability to enter numbers separated by
> > underscores for readability (like 100000 as 100_000) make life a whole lot
> > easier, especially when debugging. Is this a feature that could be
> > implemented in R?
>
> I think this could be done, but I doubt if anyone who could make the
> change would think the arbitrary decisions and added complexity in the
> parser was worth the effort. (Would it be a thousands separator, or
> could it separate any number of digits? Could a number start with an
> underscore or end with one?)
>
> Instead, I'd suggest creating variables with meaningful names to hold
> big numeric constants, e.g.
>
> AU_in_km <- 149598262 # or 149.598262e6
>
> Jupiter <- 5.2 * AU_in_km
>
> rather than
>
> Jupiter <- 5.2 * 149_598_262
>
> Duncan Murdoch
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-devel
mailing list