Skip to content
Prev 26456 / 398502 Next

More on scan()

At 10:08 20/12/2002 +1300, vous avez ?crit:
Here is a possible solution (if your data file is `yourfile.txt'):


tmp <- scan("yourfile.txt", what = "", sep = "\n")
skp <- grep("@DATA", tmp)
your.data <- scan("yourfile.txt", what = [...], skip = skp)


You may improve this by scanning line by line with:

scan("foo.txt", what = "", sep = "\n", n = 1, skip = s)

with s = 0, 1, 2, ... till you meet "@DATA".


Hope this helps.

EP

Emmanuel Paradis
Laboratoire de Pal?ontologie
Institut des Sciences de l'?volution
Universit? Montpellier II
F-34095 Montpellier c?dex 05
France
    phone: +33  4 67 14 39 64
      fax: +33  4 67 14 36 10
   mailto:paradis at isem.univ-montp2.fr
http://www.isem.univ-montp2.fr/ISEMFre/Equipes/PPP/PPerso/ParadisE.php
Message-ID: <4.2.0.58.20021219235534.00b35068@162.38.183.200>
In-Reply-To: <Pine.SOL.4.21.0212201006450.8645-100000@stat1.stat.aucklan d.ac.nz>