style icon indicating copy to clipboard operation
style copied to clipboard

Assignment (<- not =)

Open jaaan-t opened this issue 1 year ago • 2 comments

In style/syntax.qmd under Assignment it says: Use <-, not =, for assignment.

Why, though? An explanation would be helpful, especially for newcomers. <- seems unnecessary bordering on obtuse to people coming from other languages, so giving them a good explanation might help to enforce this suggestion.

jaaan-t avatar Dec 02 '24 11:12 jaaan-t

Others will probably chime in, but here is one reference to support this rule:

cf. https://www.burns-stat.com/pages/Tutor/R_inferno.pdf#page=94.19

Image

IndrajeetPatil avatar Dec 05 '24 08:12 IndrajeetPatil

Worth noting that the style guide also discourages implicit assignment:

https://github.com/tidyverse/style/blob/315943b66a6194c0b4f3b76fd2f4c12116e21b4b/syntax.qmd#L283-L286

So the above example already violates the guide.

MichaelChirico avatar Feb 07 '25 18:02 MichaelChirico