R: Is there any performance difference between using = or <

This question already has an answer here:

  • What are the differences between “=” and “<-” in R? 6 answers

  • 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 (eg, 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.

    链接地址: http://www.djcxy.com/p/73846.html

    上一篇: R:如何在不创建对象的情况下为String命名

    下一篇: R:使用=还是<性能差异?