Re: [R] transform a table into a matrix

From: John Fox <jfox_at_mcmaster.ca>
Date: Tue, 24 Jun 2008 08:10:43 -0400

Dear Maria,

On 23-Jun-08, at 11:40 PM, Maria Gavilanez wrote:

> Hi.
>
> is there a way to transform a table that has numeric and categorical
> variables into a matrix?

No, because all of the elements of a matrix must be of the same mode, but a dataframe is a data structure that can have heterogeneous columns. It's unclear from your question where the "table" is located -- in a file perhaps? If so, you can use read.table() to read the data into a dataframe.

I hope this helps,
  John



John Fox, Professor
Department of Sociology
McMaster University
Hamilton ON Canada L8S 4M4
web: socserv.mcmaster.ca/jfox

>
>
> thanks
>
>
> Maria Mercedes Gavilanez
> Department of Biological Sciences
> 107 Life Sciences Building
> Louisiana State University
> Baton Rouge, LA 70803
> (225)578-4284
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Tue 24 Jun 2008 - 12:15:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jun 2008 - 17:31:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive