Skip to content
Prev 43603 / 398513 Next

creating a factor

Dear Simon,

One doesn't generally use cbind.data.frame() directly, but rather through 
the generic function cbind(). I believe that the following will give you 
what you want:

fac <- factor(c(rep(1,7), rep(2,3)))
cbind(fac, as.data.frame(mat))

where mat is the matrix.

I hope that this helps,
  John
At 08:43 PM 2/3/2004 +1100, Simon Hosking wrote:
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox