Skip to content

strange question...

2 messages · Ana Patricia Martins, Seth Falcon

#
On 1 Feb 2006, ana.pmartins at ine.pt wrote:
A factor is an integer vector with levels.  Although there are many
operations one can perform on a factor that will "work" because of
automagic convertion of the factor to its underlying integer vector,
it is rarely useful, IMHO.

The following may help you see what is going on:

f = factor(c(0, 1, 1, 0))

unclass(f)

as.numeric(f)
as.integer(f)

as.character(f)
as.integer(as.character(f))

+ seth