guide icon indicating copy to clipboard operation
guide copied to clipboard

Template for R

Open c-martinez opened this issue 1 year ago • 6 comments

The Python chapter has a reference to our Python Template, as a way to start your project with the good practices we encourage everyone to use (license, testing, citation information, etc).

Talking to @PabRod, apparently in R-land, it is more common to use the usethis library. Instead of creating a template for R, it would make sense to have a few lines of R that serve the same purpose (start your project with good practices we encourage).

I guess it would look something like this:

library(usethis)
usethis::create_package()
usethis::use_readme_md()
usethis::use_apache_license()
usethis::use_testthat()
usethis::use_github_action()
usethis::use_citation()
usethis::use_cff()

Would more experienced R people be able to give their opinion?

c-martinez avatar May 07 '24 18:05 c-martinez

usethis is really very useful and already does a lot of templetization for you, so you could technically write a small R script to which you pass some parameters, like the name of the package etc. and then just rune the usethis library to init most of the things :)

hechth avatar May 09 '24 13:05 hechth

@maltelueken What do you think about this?

egpbos avatar Jun 19 '24 08:06 egpbos

I agree with the above! usethis is also what I would recommend to those who want to start a new R package. Having such a script (maybe publish it as a GitHub Gist?) would be a nice idea.

maltelueken avatar Jun 19 '24 08:06 maltelueken

During the research software templates session in RSECon24, there were some comments about "other tools used in R instead of templates":

  • devtools
  • https://github.com/benmarwick/rrtools

Are these equivalent? competitors? I take it our preferred / recommended way is to use usethis?

c-martinez avatar Sep 24 '24 14:09 c-martinez

Dear @c-martinez, here my answer:

  • In this regard, devtools is essentially equivalent to usethis (actually, usethis is kind of part of devtools).
  • Never heard of rrtools. It is not an official R package (yet).

So yes, usethis shall still be our focus.

PabRod avatar Sep 25 '24 09:09 PabRod