→ and ← can now be used for assignment, not just <- and ->.
function(x) x**3 can now be written fn(x) x**3, λ(x) x**3, or ƒ(x) x**3.
÷ means division.
⊗ means the Kronecker/tensor product. It matches R's existing %x% operator; %o% remains R's outer product.
Existing R spelling remains available: <-, <<-, ->, ->>, ==, function, and %x% still work.
answer ← 8 ÷ 2
answer ≟ 4The last line returns
[1] TRUE
because ≟ tests equality.
A matrix tensor product can be written directly:
A ← matrix(c(1, 2,
3, 4), nrow = 2, byrow = TRUE)
B ← matrix(c(0, 5,
6, 7), nrow = 2, byrow = TRUE)
A ⊗ Bwhich produces the same 4 × 4 matrix as A %x% B and kronecker(A, B).
| this | does |
|---|---|
x ← 3 |
assign |
x ↞ 3 |
assign in an enclosing frame |
3 → x |
assign |
3 ↠ x |
assign in an enclosing frame |
left ≟ right |
test equality |
fn(x) expression, λ(x) expression, or ƒ(x) expression |
construct a function |
left ÷ right |
divide |
left ⊗ right |
Kronecker/tensor product |
Prefer ≟ for equality. ?=, =?, ?=?, ¿=?, =, and == are aliases for the same test.
Parameters are still supplied with =.
clean.mean ← λ(x) mean(x, na.rm = TRUE)
Actually this is worse than I thought it would be, I thought there would be no downsides....
Only the = equality alias is contextual. Inside another call, wrap an equality comparison written with = in parentheses so it cannot be read as an argument name:
stopifnot((answer = 4))Code that used a single = as assignment must use an arrow in this R. The comma and argument-label rules have otherwise been left alone.
fn also used to be an ordinary name. It is reserved here, so old code using bare fn as a variable or argument must choose another name. This source uses fun; in particular, write optim(par, fun = ...) rather than optim(par, fn = ...).
The tested Linux instructions install this build in its own folder and use a separate package library. They do not remove ordinary R, alter your projects, rewrite your scripts, or upload your work. Close this R and launch ordinary R as before whenever you want to switch back.