[R] The "**" exponentiation operator.
Rolf Turner
ro||turner @end|ng |rom po@teo@net
Tue Aug 26 07:35:51 CEST 2025
On more than one occasion I have got myself into trouble by
fumble-fingering and typing "**" when I intended to type "*".
Unfortunately the expression produced is syntactically correct and the
consequent incorrect results were difficult (for me) to disentangle.
I would be much happier if the "**" operator were simply not allowed,
and threw an error. It seems to me that the existence of the "**"
operator is an archaism, probably deriving from Fortran.
The documentation, obtained from ?Arithmetic, says at one point:
> ** is translated in the parser to ^, but this was undocumented for
> many years. It appears as an index entry in Becker et al. (1988),
> pointing to the help for Deprecated but is not actually mentioned on
> that page. Even though it had been deprecated in S for 20 years, it
> was still accepted in R in 2008.
It seems still be accepted in R in 2025.
Would there be any mileage in asking R Core to deprecate "**", or
better still make it defunct? Can there be any rational basis for
keeping "**" around?
cheers,
Rolf Turner
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
+64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619
More information about the R-help
mailing list