[R] Are infix binary operators ** and ^ aliased?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Jul 12 13:54:57 CEST 2006


It appears so.  If we define ^ for class "x" then ** seems to change
in the same way:

> "^.x" <- function(x,y) x+y
> y <- structure(3, class = "x")
> y ** 4
[1] 7
attr(,"class")
[1] "x"

On 7/12/06, Jean lobry <lobry at biomserv.univ-lyon1.fr> wrote:
> Dear R-help,
>
> After making a typo (reminiscent of FORTRAN 77, I guess) I found the
> following:
>
> >  identical(all.equal(2^(-10:10), 2**(-10:10)), TRUE)
> [1] TRUE
>
> I have tried to find the documentation about the ** operator but I was
> unsuccesful this way:
>
> >  sessionInfo()
> Version 2.3.1 (2006-06-01)
> powerpc-apple-darwin8.6.0
>
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
> [7] "base"
> >  help("**")
> No documentation for '**' in specified packages and libraries:
> you could try 'help.search("**")'
> >  help.search("\\*\\*")
> No help files found with alias or concept or title matching '\*\*'
> using regular expression matching.
> >  RSiteSearch("**")
> A search query has been submitted to http://search.r-project.org
> The results page should open in your browser shortly
> # --> Too many hits
>
> Where can I find the documentation about the ** operator?
>
> Thanks for any hint,
>
> Jean Lobry
> --
> Jean R. Lobry            (lobry at biomserv.univ-lyon1.fr)
> Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
> 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
> allo  : +33 472 43 12 87     fax    : +33 472 43 13 88
> http://pbil.univ-lyon1.fr/members/lobry/
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



More information about the R-help mailing list