[R] Reg. strings and numeric data in matrix.

John Kane jrkrideau at yahoo.ca
Fri Mar 9 21:34:00 CET 2007


--- Mallika Veeramalai <mallikav at burnham.org> wrote:

> 
> Hi All,
> 
> Sorry for this basic question as I am new to this R.
> I would like to know,
> is it possible to consider a matrix with some
> columns having numeric data
> and some other's with characters (strings) data? 
> How do I get this type of
> data from a flat file.
> 
> Thanks very much,
> mallika 

If I understand the question the answer is NO. A
matrix must be of one type of data.  

I think that what you want is a data.frame wich allows
mixed categores of data.  
Try this to see the difference.

a <- c('a','b','c')
b <- c( 1,2,3)

aa <- cbind(a,b)
aa
class(aa)

bb <- data.frame(a,b)
bb
class(bb)



More information about the R-help mailing list