6 ms·
Shouldn't '<-' be used instead of '=' for variable assignments, as they aren't the same thing in R.
by Lanrei 7y ago
Shouldn't '<-' be used instead of '=' for variable assignments, as they aren't the same thing in R.
- _Wintermute 7y agoIt's a large source of bike-shedding in the R community but out of the 5 assignment operators in R, those two are largely the same. There's a good explanation here: https://stackoverflow.com/questions/1741820/what-are-the-differences-between-and-in-r#51564252 https://stackoverflow.com/questions/1741820/what-are-the-dif...
- tylermw 7y agoThey are the same thing, minus the corner case of assignment within a function call: e.g. divide = function(x, y) { return(x/y) } divide(y = 2, x = 1) divide(y <- 1, x <- 2) These two calls give the same result, as the second results in assignment and then passing the argument by position. Other than this case, they are exactly interchangeable.