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

Kurt Hornik hornik at ci.tuwien.ac.at
Mon Jun 9 10:56:18 MEST 2003


>>>>> 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



More information about the R-devel mailing list