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

Arne Henningsen ahenningsen at email.uni-kiel.de
Thu Aug 26 18:28:05 CEST 2004

Please read the "R Data Import/Export" manual. 
It should be on your harddisk and it is also available from  


On Thursday 26 August 2004 17: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!
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
ahenningsen at agric-econ.uni-kiel.de

More information about the R-help mailing list