[R] Spreadsheet math problem (exponentiation)

Erich Neuwirth erich.neuwirth at univie.ac.at
Fri Sep 18 17:13:44 CEST 2015


Let me add a little bit here:

When using math formulas, one should know about the parsing rules form complex expression
which do not have all the necessary parenthesis.

Different systems do have different parings rules.
In the case of a^b^c, the expression is ambiguus because
(as mentioned in a previous mail) in general
(a^b)^c != a^(b^c)
To avoid unintended consequences, just us parentheses and you will get
the right result.
in the case of -a^b
The question is the order of precedence of unary - and binary ^.

In Excel, -2^2=4, but 0-2^2=-4

Reason: For Excel, unary - is stronger than the power operator, but binary minus is weaker.

My feeling is that too many people are bashing spreadsheets for the wrong reason.
Spreadsheets ca do things R cannot do: Automatic recalculation when input changes,
and visual point and click modelling of dependencies.
The calculation engine of Excel admittedly has some weak points.

That is the reason why I wrote RExcel which gives you all the advantages of the spreadsheet interface
and allows you to use the R calculation within this interface whenever needed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 670 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150918/dbe37d89/attachment.bin>


More information about the R-help mailing list