Back arrow vs front arrow in R | Sololearn: Learn to code for FREE!

+13

Back arrow vs front arrow in R

When should I use the front arrow vs the back arrow for assignments ? -> vs <-

4/9/2021 2:27:26 AM

ChillPill

7 Answers

New Answer

+16

Here's something you might find interesting 👇 https://stackoverflow.com/questions/51547389/why-are-there-two-assignment-operators-and-in-r

+6

Not a direct answer, but: Doing data preparation and analysis in R, I have never used (or needed) "->" Concerning scripts (not directly typed to console code): I think our instructor used to tell us, he considered "->" bad style or something alike... (it's some time ago, I might be mistaken) edit: R also allows using "=" x = 1 but 2 = y # error edit 2: x <<- 1

+5

Arsenic thanks i tried what one comment said about magrittr. front arrows seem to keep the flow as promised https://code.sololearn.com/c5GjQ3WkvQ5I/?ref=app

+2

I'm only halfway through the R course here but haven't encountered front arrow yet. I guess it's a lot rarer.