[R] converting an ASCII file to a matrix

From: Michael Graber <michael.graber_at_mail.uni-wuerzburg.de>
Date: Wed 11 May 2005 - 01:58:14 EST

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

R-help@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 Received on Wed May 11 02:03:01 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:40 EST