This thread on stackoverflow illustrates the problem... 
https://stackoverflow.com/questions/78523612/r-factor-from-numeric-vector-drops-every-100-000th-element-from-its-levels

The issue is that factor(), applied to numeric values, uses as.character(), 
which converts numbers to character strings according to the value of scipen. 
The stackoverflow thread illustrates a case where this causes some factor 
levels to become NA. There is also an inconsistency between the treatment of 
numeric and integer values.

On the face of it, using format(..., scientific = FALSE) instead of 
as.character() would solve the problem, but this probably needs careful 
thinking through in case of other side effects!


        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to