Skip to content
Prev 393721 / 398503 Next

as.factor and floating point numbers

R converts floats to strings with ~15 digits of accuracy, specifically
to avoid differentiating between 1 and 1 + .Machine$double.eps, it is
assumed that small differences such as this are due to rounding errors
and are unimportant.

So, if when making your factor, you want all digits, you could write
this: `as.factor(format(x, digits = 17L))`
On Wed, Jan 25, 2023 at 4:03 AM Tobias Fellinger <tobby at htu.at> wrote: