Re: [Rd] factor() on a double vector

2011-02-23 Thread Hervé Pagès
On 02/23/2011 12:09 PM, Simon Urbanek wrote: Herve, the answer is simple - it's as.character() - it has nothing to do with factor or table. as.character(x) [1] "3.67" "3.67" "3.66" "3.67" That's what you are passing to factor, so you get the c

Re: [Rd] factor() on a double vector

2011-02-23 Thread Simon Urbanek
Herve, the answer is simple - it's as.character() - it has nothing to do with factor or table. > as.character(x) [1] "3.67" "3.67" "3.66" "3.67" That's what you are passing to factor, so you get the corresponding results. Cheers, Simon On Feb

[Rd] factor() on a double vector

2011-02-23 Thread Hervé Pagès
Hi, When 'x' is a vector of doubles, it's not clear how 'factor(x)' compares its values in order to determine the levels. For example, here all the values in 'x' are "conceptually" the same: x <- c(11/3, 2/3 + 4/3 + 5/3, 50 + 11/3 - 50, 7.1 - 103/30) How