Skip to content

More on scan()

1 message · Emmanuel Paradis

#
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