Monday, October 28, 2019

R: Is there any performance difference between using = or

No measurable performance difference; more about readability and convention. It's all the computations that R is doing that will make or break you.




Use <-; "R In Action" says on page 7 that it's standard and other R developers will make fun of you if you don't.



There might be a deeper reason in the R documentation:




There are three different assignment operators: two of them have
leftwards and rightwards forms.



The operators <- and = assign into the environment in which they are
evaluated.




The operator <- can be used anywhere, whereas the operator = is only
allowed at the top level
(e.g., in the complete expression typed at
the command prompt) or as one of the subexpressions in a braced list
of expressions.




It's usually a good idea to use the proper idiom of the language you're writing in.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...