ATFutures / calendar

R interface to iCal (.ics files)
https://atfutures.github.io/calendar/
Other
38 stars 10 forks source link

Style: Decide and stick-to an assignment operator #10

Closed Robinlovelace closed 5 years ago

Robinlovelace commented 5 years ago

<-, =, assign() what's it to be? At the minute we have a mixture.

mpadge commented 5 years ago

If you're at all thinking about submitting to ROpenSci, then you'll have to at some stage switch to <- anyway. Plus goodpractice::gp() is just plain out supremely helpful, and you can only minimise output there with <-.

Robinlovelace commented 5 years ago

Sounds good. It also seems there's a pkg for converting all those = into <-, from the rOpenSci style guide: https://github.com/r-lib/styler

layik commented 5 years ago

been using alt+[-] :)

Robinlovelace commented 5 years ago

More on this here: https://github.com/csgillespie/efficientR/issues/34

I use = assignment because it's good for teaching. Yihui Xie also uses it in packages. knitr, for example, a package that is central to R's ability to create documents, is written with = assignment. So it's really a matter of preference. Interested to hear your views. We discussed it at length for the geocompr book and have decided to go with =. Arguments go both ways. Origin of <- seems to be that there was a special key for it and = didn't work with Splus so it's there for historical reasons and backwards compatibility. It's ability to 'clearly show when an object has been assigned' is the strongest up-to-date reason I've heard, other than conforming to previous convention.