Is there a historical precedent of internal changes to the R
parser, adding new reserved words or symbols?
If I remember correctly data.table
uses a serendipitous :=
that was once defined but left unused in R
internals, but I'm not aware of others. However, as the language evolves, it would sometimes seem useful to define new symbols.
An obvious case could be made for magrittr's pipe %>%
which has become ubiquitous for many, but remains a pain to type (sure, there are keyboard tricks, but still). Similarly, dplyr/rlang
introduce/repurpose notations for "tidy evaluation" (!!
, !!!
, :=
, ~
, etc.).
Another case I'm seeing is the verbosity of lambda functions. Would it be possible, theoretically, to define internally something like f = λ(x) x+1
instead of f = function(x) x+1
, or are there character restrictions on top of other reasons?
R Reserved Words This list can be viewed by typing help(reserved) or ? reserved at the R command prompt as follows. Among these words, if , else , repeat , while , function , for , in , next and break are used for conditions, loops and user defined functions.
%% gives Remainder. %/% gives Quotient. So 6 %% 4 = 2. In your example b %% a , it will vectorised over the values in “a” © Copyright 2013-2022 Analytics Vidhya.
Tilde operator is used to define the relationship between dependent variable and independent variables in a statistical model formula. The variable on the left-hand side of tilde operator is the dependent variable and the variable(s) on the right-hand side of tilde operator is/are called the independent variable(s).
Why add an ergonomics feature if you risk breaking a runtime that hosts a huge ecosystem? Also, once you add one feature, you are on a slippery slope and are staring straight in the face of feature bloat.
And if you say that we can be smart and judicious about what features we add, how do we structure that decision process? R does not have a "benevolent dictator" having a final word in decisions like this so you are left with design by committee with all that it entails.
The big thing with R has always been the package ecosystem, in which if you want a feature you write it yourself -- as in your magrittr
example. The language itself has remained close to its S roots and has successfully served as a stable platform for all the development that has been happening.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With