Dear List,
why does as.data.frame(cbind()) transform numeric variables to
factors, once one of the other variablesused is a character vector?
#
x.1 - rnorm(10)
x.2 - c(rep(Test,10))
Foo - as.data.frame(cbind(x.1))
is.factor(Foo$x.1)
Foo - as.data.frame(cbind(x.1,x.2))
is.factor(Foo$x.1)
#
I
On Fri, 2006-08-18 at 10:41 -0400, Tom Boonen wrote:
Dear List,
why does as.data.frame(cbind()) transform numeric variables to
factors, once one of the other variablesused is a character vector?
#
x.1 - rnorm(10)
x.2 - c(rep(Test,10))
Foo - as.data.frame(cbind(x.1))
is.factor(Foo$x.1)
On Fri, 18 Aug 2006, Tom Boonen wrote:
Dear List,
why does as.data.frame(cbind()) transform numeric variables to
factors, once one of the other variablesused is a character vector?
#
x.1 - rnorm(10)
x.2 - c(rep(Test,10))
Foo - as.data.frame(cbind(x.1))
is.factor(Foo$x.1)
Foo -
In R version 2.4.0 Under development (unstable) (2006-08-08 r38825)
one can do this:
as.data.frame(cbind(x.1,x.2),stringsAsFactors = FALSE)
On 8/18/06, Tom Boonen [EMAIL PROTECTED] wrote:
Dear List,
why does as.data.frame(cbind()) transform numeric variables to
factors, once one of the
Thanks everybody. I recognize my mistake now.
I think as.data.frame(cbind(x.1,x.2),stringsAsFactors = FALSE) would
be a good idea.
Tom
On 8/18/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
On Fri, 18 Aug 2006, Tom Boonen wrote:
Dear List,
why does as.data.frame(cbind()) transform
Tom == Tom Boonen [EMAIL PROTECTED]
on Fri, 18 Aug 2006 11:16:45 -0400 writes:
Tom Thanks everybody. I recognize my mistake now.
Tom I thinkas.data.frame(cbind(x.1,x.2),stringsAsFactors = FALSE)
Tom would be a good idea.
I think
data.frame(x.1, x.2 = I(x.2))
would