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])
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:
- 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 =
- Cmd + shift + d =
If you are on Windows, Use
Ctrl in the place of
Cmd for the above shortcuts work.