Re: [R] regular expression

From: Prof Brian Ripley <>
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 ! 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

      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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list PLEASE do read the posting guide 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 Please read the posting guide before posting to the list.