I am about to write general functions to read the output of simulations models.

These model generate output files with different sections which I want to analyze plot etc.

Since this will be used many people at the department I wanted to make sure that will do this in the best way.

For instance I want to read a snippets of data from a text that look like this.
-------------------------------
Lots of stuff
...
@@Start Values@@
Column1 Column2 Column3 ...
Row1 1 2 3 ...
...
@@End Values@@


More stuff
...
@@Start OtherValues@@
        Column1 Column2 Column3 ...
Row1    1       2       3 ...
...
@@End OtherValues@@


I looked in the help files and found grep which operates on character strings, do I have to like this then?


1. Read file with readLines("foo.txt")
2. grep this object for the start and end of each section ->startline & stopline
3. Read the file again with read.table("foo.txt",skip=startline,nrows=stoplin-startline)


Or is there a more beautiful way?

Cheers,
---------------------------------------------
Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
[EMAIL PROTECTED]
http://www.nioo.knaw.nl/ppages/handersson

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to