From hornik at ci.tuwien.ac.at  Mon Jun  9 10:56:18 2003
From: hornik at ci.tuwien.ac.at (Kurt Hornik)
Date: Mon Jun  9 12:38:17 2003
Subject: [Rd] Interpretation of escaped characters in \examples{}
In-Reply-To: <5.2.0.9.1.20030607234311.00af8490@imaphost.wehi.edu.au>
References: <5.2.0.9.1.20030526114014.00ac1008@imaphost.wehi.edu.au>
	<5.2.0.9.1.20030524191550.00ac35c0@imaphost.wehi.edu.au>
	<5.2.0.9.1.20030607234311.00af8490@imaphost.wehi.edu.au>
Message-ID: <16100.15778.798063.339743@mithrandir.hornik.net>

>>>>> Gordon Smyth writes:

> Dear Kurt,

>>>

> When going from the help file to rendered code, double backlashes are
> now left as-is. Single backslashes are removed, *except* for "\b",
> "\n", "\r" and "\f". Escaped t's, "\t" are converted to actual tabs.

Going from help to rendered code means via example()?  What happens
there is that is R-ex file is *sourced*, i.e., parsed and evaluated, so
what we see is what R does.

> Is this all as it is supposed to be? The conversion of \t to <tab>
> does seem a potential problem.

> The conversion of \t to <tab> occurs in other examples of rendering
> code also, for example:

>> myfun <- function(x,pattern="\t") "hello"
>> args(myfun)
> function (x, pattern = "        ")

I cannot reproduce this: if I add

f <- function(x = "\t") "hello"
args(f)

to eda/R-ex/line.R and do example("line", "eda") I get

line> f <- function(x = "\t") "hello"

line> args(f)
function (x = "\t") 
NULL

without the tab being expanded ...

Best
-k


[Rd] Interpretation of escaped characters in \examples{}
Kurt Hornik