7 ms·
R has a rich heritage of trolling unsuspecting programmers coming from other languages. In ancient versions of R from the early 2000s, the underscore operator
by minimax 14y ago
R has a rich heritage of trolling unsuspecting programmers coming from other languages. In ancient versions of R from the early 2000s, the underscore operator was synonymous for '<-', aka assignment. This is why in R some use periods for separators (ice.cream) rather than underscores (ice_cream), though just to make things more lulzy some package authors have started to use Java style camel case (iceCream) too.
I saw an example of R code using underscore for assignment posted on twitter a couple of months ago. See if you can make heads or tails of this: http://www.stat.washington.edu/hoff/Code/hoff_raftery_handcock_2002_jasa/dist.r http://www.stat.washington.edu/hoff/Code/hoff_raftery_handco...
- pygy_ 14y ago> This is why in R some use periods for separators (ice.cream) rather than underscores (ice_cream) ... and since the dot is legal in identifiers, they use $ as lookup operator. > ice.cream$flavor [1] "chocolate" "vanilla" "butterscotch advocado surprise"
- rabz 14y ago> In ancient versions of R from the early 2000s, the underscore operator was synonymous for '<-', aka assignment. Huh, early Smalltalk mapped the left arrow to the underscore key; I'm not sure if Squeak and Pharo still do it, though.