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.
> sessionInfo()
R version 2.10.1 RC (2009-12-09 r50695)
x86_64-apple-darwin9.8.0

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
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to