Gabor Grothendieck wrote:
michael watson (IAH-C michael.watson at bbsrc.ac.uk writes:
:
: Hi
:
: I'm seeing some odd behaviour with cbind(). My code is:
:
: cat - read.table(cogs_category.txt, sep=\t, header=TRUE,
: quote=NULL, colClasses=character)
: colnames(cat)
: [1] Code
cat is a data.frame,
so cbind is use for a data.frame
and
?data.frame tell us that:
Character variables passed to 'data.frame' are converted
to factor columns unless protected by 'I'.
PS : it is not good ides to call your data.frame cat as there is a cat
function.
At 09:19 10/12/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
michael watson (IAH-C michael.watson at bbsrc.ac.uk writes:
:
: Hi
:
: I'm seeing some odd behaviour with cbind(). My code is:
:
: cat - read.table(cogs_category.txt, sep=\t, header=TRUE,
: quote=NULL, colClasses=character)
: colnames(cat)
: [1] CodeDescription
:
Probably you called the build-in rainwbow-function, which returns a string.
str(rainbow(10))
chr FF
Dieter Menne
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!