How to create an R package ๐ฆ
Check out the slidedeck to quickly build your first package! ๐ด โ๏ธ ๐
Here's an alternate Git/RStudio workflow you can use to get your package started:
- Create an new GitHub repo on https://github.com/new
- Create a new Git R project (File --> New Project --> Version Control --> Git --> [paste in Repository URL] & [Create Project])
- Use
devtools::create(".")
to initiate a package. You can say "no" when it asks you to overwrite the RProj file.
Other tips and resources
Also check out these guides to package development in R:
- Writing an R package from scratch blogpost by Hilary Parker
- R packages book by Hadley Wickham
- R packages cheatsheet
- Official writing R extensions guide
Here are some other great packages you may want to check out:
- usethis
- goodpractice
- styler for auto-style checking
- lintr for style - use with Travis to auto-check your code!
- pkgdown for creating a website for your package
And some keyboard short-cuts:
- Cmd + i = auto-indent
- Cmd + opt + shift + r = auto-generate roxygen skeleton
- Cmd + shift + t =
devtools::test()
- Cmd + shift + d =
devtools::document()
Other reading/resources:
- Unix Design Philosophy - design principles to think about when designing software/etc; many points are echoed in the R packages book