Hacker News new | ask | show | jobs
by mannykannot 3114 days ago
I don't get how a keyboard shortcut deals with the '<-' issue, which is the occasional and subtle difference in semantics from '='. Even if you can pick just one for your own work, it doesn't help with other people's code.

Tidyverse is new to me, I must check it out.

2 comments

RStudio shortcut for <- is alt and -.

Also Tidyverse and data.table are the main reason for the sudden explosion of R's popularity. For me I love the piping since I am an old time bash user and | becomes %>% in R is the best thing for the way i think.

Typing '<-' is a fairly trivial matter, I think, compared to the semantic issues raised at the start of this thread, and covered in the question and answers below - for example (from the chosen answer): "R's syntax contains many ambiguous cases that have to be resolved one way or another. The parser chooses to resolve the bits of the expression in different orders depending on whether = or <- was used."

https://stackoverflow.com/questions/1741820/assignment-opera...

Just use the '<-' all the time, except in function calls. If you can use '<-' with an easy key press you will not be tempted to use '='. And the problem is greatly reduced.

But yes, the problem is still there.