Skip to content
Prev 33704 / 63424 Next

nchar on factors

Stavros Macrakis wrote:
The documentation has:

 >>
The internal equivalent of the default method of as.character is 
performed on x (so there is no method dispatch). If you want to operate 
on non-vector objects passing them through deparse first will be required.
<<

and (notice the no method dispatch bit)

 > as.character(unclass(factor(LETTERS)))
  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" 
"14" "15"
[16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26"

So, the documentation does appear to be in sync with the code (useful or 
not).