[Rd] Parsing code with newlines

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Thu Apr 11 10:57:56 CEST 2019


”\r" is CR not LF. On systems that use CRLF as newline, the combination should be "\n" at the C (or R) level. 

However, I suppose there is no particular reason not to treat CR as whitespace, as does happen with FF and HT.

-pd

> On 11 Apr 2019, at 01:59 , Mikhail Titov <mlt using gmx.us> wrote:
> 
> The barely modified test code I had in my previous post, does not parse
> what would seem a legit sample string "\r\n ls()". However, it does
> parse alright "\n ls()". Nowhere in the docs the intolerance to line
> feeds is mentioned. It is reproducible from R console as well.
> 
> ,----[ R console session ]
> | > parse(text="\r\n ls()")
> | Error in parse(text = "\r\n ls()") : <text>:1:1: unexpected input
> | 1:
> |     ^
> | >
> `----
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-devel mailing list