[R] newbie question: how to read a file into a matrix

Ernesto Jardim ernesto at ipimar.pt
Thu Aug 26 18:31:48 CEST 2004


On Thu, 2004-08-26 at 16:47, Gaby Aguilera wrote:
> I am trying to read a file with 8 columns and about 200 rows into a
> matrix.  I tried something like:
> x<-matrix(data="data.txt", nrow=200, ncol=8) but this produces a
> matrix with "data.txt" in it.  Is there a way to read the data in?
> 
> Any pointers in the right direction would be appreciated.  Thank you!
> 

Hi,

Read the R manuals ... and use function "read.table" or similar.

EJ




More information about the R-help mailing list