Redefining operators can be useful in translating R syntax
to some other language. E.g., dplyr does that sort of thing
to translate to sql. It puts the altered definition into an environment
that is used only for such translation so it doesn't mess up
other functions.
> dplyr::base_scalar$`{`
One could redefine the "{" function with something like
`{` <- function(...) simplify2array(list(...))
but then you would have to live with the syntax it requires
(semicolons for separators instead of commas)
> {1; 2; 3}
[1] 1 2 3
> {{11;12;13}; {21;22;23}; {31;32;33}}
[,1] [,2
On 17 Apr 2015, at 06:19 , Mick Jordan wrote:
> I am curious if anyone knows of R code where the "{" function is redefined in
> a useful way. Or "(" for that matter.
I sincerely would hope not
Incidentally, I seem to recall that during the design of (new?) S, it was at
some point the int
I am curious if anyone knows of R code where the "{" function is
redefined in a useful way. Or "(" for that matter.
Thanks
Mick
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
On Sat, Feb 8, 2014 at 10:44 AM, Simon Urbanek
wrote:
> Gábor,
>
> On Feb 8, 2014, at 10:19 AM, Gábor Csárdi wrote:
>
> > Hi All,
> >
> > is there a caveat in redefining .Call in a package? (Apart from the
> > performance hit of the extra function call.)
> >
>
> Why don't you just do s/\.Call/myC
Gábor,
On Feb 8, 2014, at 10:19 AM, Gábor Csárdi wrote:
> Hi All,
>
> is there a caveat in redefining .Call in a package? (Apart from the
> performance hit of the extra function call.)
>
Why don't you just do s/\.Call/myCall/g in R/* instead? That would be a bit
less dangerous in case you fo
Hi All,
is there a caveat in redefining .Call in a package? (Apart from the
performance hit of the extra function call.)
I want to execute a check every time I call back to C, and this seems to be
the easiest solution, instead of modifying all functions of the package. It
also seems to be a good
This should now be fixed in r-devel and 3.0.0 Patched as of revision 62487.
On Mar 29, 2013, at 11:30 AM, John Chambers wrote:
> Nothing to do with initFields. If you trace your redefined quote(), it's
> called from the <<- assignment of x.
>
> The "x" element in the environment for the refer
Nothing to do with initFields. If you trace your redefined quote(), it's
called from the <<- assignment of x.
The "x" element in the environment for the reference class object is
implemented as an active binding in order to enforce the class when assigning
the field.
Effectively that makes th