[R] converting an ASCII file to a matrix

Michael Graber michael.graber at mail.uni-wuerzburg.de
Tue May 10 17:58:14 CEST 2005

Dear R-WinEdit users,

I have a simple question, but somehow I cannot find the answer even
though I tried a lot!

I have an unstructured ASCII-file and I want to import it into a matrix
m in R, so that every character is defined by m[i;j]. The rows are not
of the same length.

The file looks like the following shortened abstract example:

name: xxxxx xxxx
age: 9.9.99
record number: 999
title: xxxxx xxxx xxx
keywords: xxx xx

"white space"

name: yyyy yyyyyyyyyyyy
age: 8.8.88
record number: 8
title: yyyy yy yyyy
keywords: yyyyyyyyyyy yyyyyyyy yyy

"white space"

The result should be for example: m[1;1]=n
I would be very grateful for your help!

Michael Graber
michael.graber at mail.uni-wuerzburg.de

More information about the R-help mailing list