[R] cbind() and factors.

Rolf Turner rolf at math.unb.ca
Fri Dec 10 15:40:18 CET 2004


This is of the nature of an FAQ.  Data frames coerce character
vectors into factors.  If you want a character vector to stay
that way (and not become a factor) wrap in up in ``I()'':

	cat <- cbind(cat,Color=I(rainbow(nrow(cat))))

(There's no need to quote the name ``Color'' in the foregoing.)

				cheers,

					Rolf Turner
					rolf at math.unb.ca




More information about the R-help mailing list