Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider guidance for R code? #203

Open
steffilazerte opened this issue Jul 25, 2022 · 4 comments
Open

Consider guidance for R code? #203

steffilazerte opened this issue Jul 25, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@steffilazerte
Copy link
Collaborator

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:

  • library() not require()

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...

  • Use a package more than a couple times, import it with library() rather than use pkg_name::
  • Use comments to explain why using certain features (i.e. set.seed() etc.)
  • 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)
@maelle
Copy link
Collaborator

maelle commented Jul 26, 2022

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 😂 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 steffilazerte changed the title Consider guideance for R code? Consider guidance for R code? Jul 26, 2022
@steffilazerte steffilazerte self-assigned this Jul 26, 2022
@steffilazerte steffilazerte added the enhancement New feature or request label Jul 26, 2022
@steffilazerte
Copy link
Collaborator Author

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 😁.

@maelle
Copy link
Collaborator

maelle commented Jul 26, 2022

Looking forward to debating reviewing 😉

@yabellini
Copy link
Member

Me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants