A matrix can only have 1 type of data, so if you try to include both
strings and numbers in a matrix, the numbers will be converted to
strings.

Another type of data object is a data frame, a data frame works much
like a matrix in many ways, but allows some columns to be numbers and
others to be strings (though usually strings are converted to factors).

You should read (or reread) the help page "An Introduction to R",
section 5 talks about matricies, then section 6 talks about data frames
(and lists).  Section 7 shows how to read data from files into data
frames.  Those 3 sections should answer your questions below.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Mallika Veeramalai
> Sent: Friday, March 09, 2007 1:03 PM
> To: [email protected]
> Subject: [R] Reg. strings and numeric data in matrix.
> 
> 
> 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 
> 
> ______________________________________________________________
> ______________
>     Mallika Veeramalai, Ph.D.,
>     Postdoctoral Associate,
>     Bioinformatics & Systems Biology,
>     Burnham Institute for Medical Research,
>     La Jolla,  CA 92037, USA.
>     phone : +1 858 646 3100 ext: 3627
>     Fax   : +1 858 795 5249
>     Web   : http://bioinformatics.burnham.org/~mallika/
>     Email : [EMAIL PROTECTED] (or) [EMAIL PROTECTED]
> 
> ______________________________________________
> [email protected] 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.
>

______________________________________________
[email protected] 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.

Reply via email to