On Mon, Aug 24, 2009 at 5:36 PM, Peter Dalgaard <p.dalga...@biostat.ku.dk>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). May I suggest that the documentation be made more explicit? For example, "x is converted to a character vector using as.character(unclass(...))". That eliminates the reference to internals, which is inappropriate in user documentation. -s PS What *is* the rationale for this? Other functions which expect character inputs seem to do as.character, not as.character/unclass for factors: grep( 'x', factor('x')) => 1 paste(factor('x')) => "x" tolower(factor("x")) => "x" charmatch('x',factor('x')) => 1 factor('x',levels=factor('x')) => x / Levels: x format(factor('x')) => 'x' [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel