Re: [R] regular expression

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 07 Apr 2007 - 17:22:22 GMT

On Sat, 7 Apr 2007, Laurent Rhelp wrote:

[...]

> I had had to modify the line below to allow for the connexion :
>
> temp <- readLines(file(file.path(dirdata, "initial", i)))

You do not need the file() here.

> I didn't understand that readLines read all the file in one go, I
> understood that it read only one line !..so I did a loop on the lines of
> every file which is not necessary.

Please do read the help page for readLines, (very carefully before posting). It says:

      readLines(con = stdin(), n = -1, ok = TRUE, warn = TRUE)

      con: a connection object or a character string.

        n: integer.  The (maximal) number of lines to read. Negative
           values indicate that one should read up to the end of the
           connection.

      If the 'con' is a character string, the function calls 'file' to
      obtain a file connection which is opened for the duration of the
      function call.


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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 and provide commented, minimal, self-contained, reproducible code. Received on Sun Apr 08 03:29:26 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 07 Apr 2007 - 18:31:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.