Re: [R] cbind() and factors.

2004-12-11 Thread Frank E Harrell Jr
Gabor Grothendieck wrote: michael watson (IAH-C 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""Description

Re: [R] cbind() and factors.

2004-12-10 Thread Gabor Grothendieck
michael watson (IAH-C 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""Description" : > is.factor(cat$Code)

Re: [R] cbind() and factors.

2004-12-10 Thread Dieter Menne
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! http://www.R-proje

Re: [R] cbind() and factors.

2004-12-10 Thread Rolf Turner
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 foregoi

Re: [R] cbind() and factors.

2004-12-10 Thread Stephane DRAY
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, mich