-2

I need to access the data in the columns from a text file having name "Apure.asc". I cannot use the read.table or read.csv on it because it contains some extra text in it in the starting which makes it hard for R to open it as a table or a csv file. I also tried using import.asc function from the adehabitat library, but it doesn't seems to work.

The text file looks like as follows:

TANKEXE: Sugawara-IHE tank model. Development: D.P. Solomatine
Output to file: D:\Work from Home\Apure53.ASC
Input CAL file: D:\Work from Home\Apure53.CAL  (53 time points)
Input PIN file: D:\Work from Home\g.pin  with values:
      8820.7440,48.7801,0.0215,0.0361,0.0436,0.0050,915.2973,113.4371, 
Calculated error value(s) :  
(3) Weighted root mean squared error        :       21.0927

Time       ObservedCalculated runoff, Water balance
 1,         5.3482,        76.7017,     1027.7425
 2,         4.7455,        67.4817,      954.3219
 3,         3.9938,        58.9400,      884.5183
 4,         3.5208,        51.0347,      818.1752

Any suggestions on how to access the column data from such a file.

thelatemail
  • 91,185
  • 12
  • 128
  • 188
  • 1
    Why don't you check the `skip` option in `?read.table`? It allows you to skip a certain amount of lines and then start reading your file. – Peter Diakumis Mar 10 '15 at 00:19

1 Answers1

0

Something like this should work,

read.csv("Apure.asc", skip=7, strip.white=TRUE) # 7 should match number of non-data, non-blank lines in header
jaimedash
  • 2,683
  • 17
  • 30