Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    \$\begingroup\$ use l<-... instead of (l=...); it's a byte shorter :-) \$\endgroup\$ Commented May 19, 2020 at 17:03
  • \$\begingroup\$ Thanks again Giuseppe! BTW: do you have any idea why <- should be designed to behave differently to = in this context (apart from sneaky code golf use)? \$\endgroup\$ Commented May 19, 2020 at 19:36
  • 1
    \$\begingroup\$ The docs say 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. So since l is actually an argument to the [ function, it's not at the top level. Or so I believe. \$\endgroup\$ Commented May 19, 2020 at 19:43
  • \$\begingroup\$ Thank you: I will try to digest what that means. It's quite disconcerting to imagine that I might actually learn something useful while trying to just waste my time code golfing... \$\endgroup\$ Commented May 19, 2020 at 19:54
  • \$\begingroup\$ You're not the only one! Myself included, haha. Sometimes my golfing habits kick in when writing real R code, though... \$\endgroup\$ Commented May 19, 2020 at 19:55