[R] Labeling matrix data

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Apr 30 08:56:23 CEST 2002

On Tue, 30 Apr 2002, hkimscil wrote:

> Hello all -
> I am sorry if this simple question is addressed in somewhere else. But, I couldn't find it. It's been for about a week using R. . .
> My problem is:
> Reading matrix data with "scan" does not seem to allow me to incorporate matrix labels (columns, and rows).
> If I use read.table, I can import the lables. But, the problem is, I don't know how I make this data as matrix.

Use as.matrix or data.matrix.

You need to consider if you want a character or numeric matrix, but if all
your input is numbers (apart from row and column names) either will do.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list