> One of the things about R which many (and that certainly includes > me) have to find out the hard way is that you have to *learn* > what to expect! You can't just import it from prior experience in > other contexts. So, by the time you have learned that a matrix > is such that all its elements must have the same type, whereas > the components of a list (or as special case the columns of a > dataframe) can be of different types, you expect the first result > (your "cbind(1:2,letters[1:2])"): R can coerce the numerical > elements to character type, but letters have too much character > to allow themselves be coerced into numerical.
cbind is not the best example, because it has rather complex behaviour: cbind(1:2, letters[1:2]) cbind(1:2, letters[1:2], data.frame(1:2)) cbind(cbind(1:2, letters[1:2]), data.frame(1:2)) Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.