On Sun, 27 Dec 2009, David Winsemius wrote:
On Dec 27, 2009, at 2:07 AM, Prof Brian Ripley wrote:
Hmm, when I run example(body) I get
body> body(f) <- as.call(c(as.name("{"), e))
with no backslash. And text help and the refman also have no backslash.
So, how are you doing this? Cut-and-paste from HTML help?
Yes; that was how I entered it, but just now I entered this line from the
keyboard and got the same result:
body(f) <- as.call(c(as.name("\{"), e))
Warning messages:
1: '\{' is an unrecognized escape in a character string
2: unrecognized escape removed from "\{"
Correct, as that is not a valid string in R ... R-devel gives an
error.
--
I suspect this is yet another rendering problem with HTML help: I've fixed
quite a few since 2.10.1 was released.
On Sat, 26 Dec 2009, David Winsemius wrote:
I am getting a warning when using the example s on the help page for body:
f <- function(x) x^5
body(f) <- quote(5^x)
## or equivalently body(f) <- expression(5^x)
f(3) # = 125
[1] 125
body(f)
5^x
## creating a multi-expression body
e <- expression(y <- x^2, return(y)) # or a list
body(f) <- as.call(c(as.name("\{"), e))
Warning messages:
1: '\{' is an unrecognized escape in a character string
2: unrecognized escape removed from "\{"
f
function (x)
{
y <- x^2
return(y)
}
f(8)
[1] 64
The text of the Details section says that:
"The bodies of all but the simplest are braced expressions, that is calls
to {: see the ‘Examples’ section for how to create such a call."
So I am puzzled that "\{" is being removed.
That is *not* what the message says: it says the backslash is being
removed.
sessionInfo()
R version 2.10.1 RC (2009-12-09 r50695)
x86_64-apple-darwin9.8.0
Please update to a released version.
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid splines stats graphics grDevices utils datasets
methods base
other attached packages:
[1] gplots_2.7.4 caTools_1.10 bitops_1.0-4.1 gdata_2.6.1
gtools_2.6.1
[6] hexbin_1.20.0 seqinr_2.0-7 kernlab_0.9-9 IDPmisc_1.1.06
lattice_0.17-26
[11] Design_2.3-0 Hmisc_3.7-0 survival_2.35-7
loaded via a namespace (and not attached):
[1] cluster_1.12.1 tools_2.10.1
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac