Re: [Rd] clients and carriage returns

From: Joe Conway <>
Date: Wed, 20 Jun 2007 13:09:44 -0700

Prof Brian Ripley wrote:
> I think the question is how are you accessing the parser? The only
> public interface is R_ParseVector, and that works like parse(text=):

Yes, I'm using R_ParseVector. PL/R basically takes the function's text as stored in the Postgres system catalog table (prosrc field of pg_catalog.pg_proc), and feeds it to R_ParseVector more-or-less unchanged (currently).

> This does not happen when reading from files, as the connection
> machinery converts line endings (or fgets does). So I think the problem
> may be in how you (or PostgreSQL) are getting text from files.

That makes sense. Many people use a database client such as PgAdmin III to create PL/R (and other) functions. PgAdmin adds standard Win32 EOLs to multiline CREATE FUNCTION statements, and Postgres dutifully stores them with the rest of the text in the catalog, exactly as received.

> The rules of R syntax are quite simple, e.g.
> Newlines have a function which is a combination of token separator and
> expression terminator. If an expression can terminate at the end of
> the line the parser will assume it does so, otherwise the newline is
> treated as whitespace. Semicolons (@samp{;}) may be used to separate
> elementary expressions on the same line.

I saw this paragraph, but it failed to register (through my thick skull) that Newline is quite literally \n. Thanks for pointing it out.

Best regards,

Joe mailing list Received on Wed 20 Jun 2007 - 20:19:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jun 2007 - 08:35:39 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.