G'day Gregor, >>>>> "GG" == Gregor Gorjanc <[EMAIL PROTECTED]> writes:
GG> I am writing some functions and I repeatedly acces internal GG> factor codes. I figured out that internal codes are 1:n where GG> 1 represents 1st level, 2 2nd level etc. This is not GG> documented [...] The help page for factor states in the 'Details' section: The encoding of the vector happens as follows. First all the values in 'exclude' are removed from 'levels'. If 'x[i]' equals 'levels[j]', then the 'i'-th element of the result is 'j'. If no match is found for 'x[i]' in 'levels', then the 'i'-th element of the result is set to 'NA'. Note in particular the part on "then the 'i'-th element of the result is 'j'". This pretty much documents that the internal codes are 1:n and 'NA', as documented in the following sentence. Cheers, Berwin ========================== Full address ============================ Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics +61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009 e-mail: [EMAIL PROTECTED] Australia http://www.maths.uwa.edu.au/~berwin ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel