Re: [R] as.factor and floating point numbers

2023-01-25 Thread Tobias Fellinger
Hello, I'll reply in one mail to all. Thank you for your suggestions. I already tried Andrews solution with increasing the digits. In the most extreme case I encountered I had to take the maximum possible digits in format but it worked. Tims solution is also a good workaround but in this

Re: [R] as.factor and floating point numbers

2023-01-25 Thread Valentin Petzel
Hello Tobias, A factor is basically a way to get a character to behave like an integer. It consists of an integer with values from 1 to nlev, and a character vector levels, specifying for each value a level name. But this means that factors only really make sense with characters, and anything

Re: [R] as.factor and floating point numbers

2023-01-25 Thread Ebert,Timothy Aaron
resolution than one year sampled in microseconds. Tim -Original Message- From: R-help On Behalf Of Andrew Simmons Sent: Wednesday, January 25, 2023 4:13 AM To: Tobias Fellinger Cc: r-help@r-project.org Subject: Re: [R] as.factor and floating point numbers [External Email] R converts

Re: [R] as.factor and floating point numbers

2023-01-25 Thread Andrew Simmons
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

[R] as.factor and floating point numbers

2023-01-25 Thread Tobias Fellinger
Hello, I'm encountering the following error: In a package for survival analysis I use a data.frame is created, one column is created by applying unique on the event times while others are created by running table on the event times and the treatment arm. When there are event times very close