ropensci-org / blog-guidance

rOpenSci Blog Guidelines for Authors and Editors (bookdown::git_book)
https://blogguide.ropensci.org/
9 stars 4 forks source link

Consider guidance for R code? #203

Open steffilazerte opened 2 years ago

steffilazerte commented 2 years ago

I tend to implement my own preferences for R code, and I'm not sure if we should chat about whether there are any standards that are important enough to put as a requirement in the Blog Guide.

For example, I enforce what I think is 'correct' or best practices coding:

These are things I suggest in order to make code more understandable by readers who may not be as familiar, but I'm not sure I'd want to really add this to the blog guide, as they're somewhat subjective...

maelle commented 2 years ago

Excellent idea!

library() not require()

That one could be automated! So if you go for this please open an issue in roblog.

Use a package more than a couple times, import it with library() rather than use pkg_name::

Ah I see what you mean but I tend to namespace all the things :joy: The guidance should mention this, something about balancing the clarity of where functions come from with the visual clutter.

Use comments to explain why using certain features (i.e. set.seed() etc.)

Nice. The review would help pinpoint what things are comment-worthy.

Be explicit about argument names when they're not common (i.e. I wouldn't worry about mean(c(1,2,3)) but I would worry about mean(c(1,2,3), 1, FALSE)

Good point!

steffilazerte commented 2 years ago

I think I can write a small section in the Blog Guide for this, and have @maelle and @yabellini review it to make sure I'm not being too opinionated :grin:.

maelle commented 2 years ago

Looking forward to debating reviewing :wink:

yabellini commented 2 years ago

Me too!