Are there any guarantees of whether x will equal 1 or 2 after this is run? (x <- 1) * (x <- 2) ## [1] 2 x ## [1] 2 -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
IMHO this is just bad practice. Whether the result is guaranteed or not, doesn't matter. ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkelinx at inbo.be Havenlaan 88 bus 73, 1000 Brussel www.inbo.be /////////////////////////////////////////////////////////////////////////////////////////// To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey /////////////////////////////////////////////////////////////////////////////////////////// <https://www.inbo.be> Op vr 27 aug. 2021 om 17:18 schreef Gabor Grothendieck < ggrothendieck at gmail.com>:> Are there any guarantees of whether x will equal 1 or 2 after this is run? > > (x <- 1) * (x <- 2) > ## [1] 2 > x > ## [1] 2 > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
On Fri, 27 Aug 2021, Gabor Grothendieck writes:> Are there any guarantees of whether x will equal 1 or 2 after this is run? > > (x <- 1) * (x <- 2) > ## [1] 2 > x > ## [1] 2At least the "R Language Definition" [1] says "The exponentiation operator ?^? and the left assignment plus minus operators ?<- - = <<-? group right to left, all other operators group left to right. That is [...] 1 - 1 - 1 is -1" which would imply 2. [1] https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Infix-and-prefix-operators -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net