Call it walrus operator, closes #1591
This commit is contained in:
parent
03dbd81dbb
commit
fd39b442f4
|
@ -737,7 +737,7 @@ sorted_bars <- function(df, var) {
|
||||||
diamonds |> sorted_bars(clarity)
|
diamonds |> sorted_bars(clarity)
|
||||||
```
|
```
|
||||||
|
|
||||||
We have to use a new operator here, `:=`, because we are generating the variable name based on user-supplied data.
|
We have to use a new operator here, `:=` (commonly referred to as the "walrus operator"), because we are generating the variable name based on user-supplied data.
|
||||||
Variable names go on the left hand side of `=`, but R's syntax doesn't allow anything to the left of `=` except for a single literal name.
|
Variable names go on the left hand side of `=`, but R's syntax doesn't allow anything to the left of `=` except for a single literal name.
|
||||||
To work around this problem, we use the special operator `:=` which tidy evaluation treats in exactly the same way as `=`.
|
To work around this problem, we use the special operator `:=` which tidy evaluation treats in exactly the same way as `=`.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue