[Rd] Internal codes of the factor

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Wed Mar 15 06:32:01 CET 2006


Berwin A Turlach wrote:
> G'day Gregor,
> 
> 
>>>>>>"GG" == Gregor Gorjanc <gregor.gorjanc at bfro.uni-lj.si> 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.

Thanks for this pointer to documentation.

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc

----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.



More information about the R-devel mailing list