Assignment in R

I’ve starting learning a little bit of R. It’ll be a slow process but I’m enjoying it. Once thing in particular that I like is how assignment is handled in R.

You can use = to assign: x = 5

Or you can use an arrow: x <- 5

I prefer the arrow because it draws a clear line between assignment and equality. Of course it could cause some problems.

Does x <- 5 mean the value of x is 5, or does it mean x is less than negative 5?

I try to solve this problem by using spaces around both sides of the arrow when I am assigning a value and putting a space between the < and the – when saying less than a negative.

Anyway, I’m early in my R journey. But I wanted to share one thing I like about it.