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

Rau, Roland Rau at demogr.mpg.de
Thu Aug 26 18:25:53 CEST 2004


	-----Original Message-----
	From:	r-help-bounces at stat.math.ethz.ch
[SMTP:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gaby Aguilera
	Sent:	Thursday, August 26, 2004 5:47 PM
	To:	r-help at stat.math.ethz.ch
	Subject:	[R] newbie question: how to read a file into 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!
	The pointer in the right direction is the bottom of each message:
read the posting guide. And there it says you should at least read the
relevant section in "An Introduction to R" which is shipped with every
distribution of R. So please read section 7 there.
	What you probably want to do is:
	### assuming you are working on Windows
	x <- read.table("c:\\mydatafolder\\data.txt", sep=",", header=TRUE)
	# depending on your separator and whether you have variable names 

	For some more information you may also check the "R Data
Import/Export Manual" also included in every distribution of R.


This mail has been sent through the MPI for Demographic Rese...{{dropped}}

More information about the R-help mailing list