Create an R Package
December 20 2022
packages.Rmd
R package reference materials
Creating an R Package
You’ll find a guide on how to create an R package linked to GitHub in RStudio in a guide on this website.
Other reference material
The R Packages book is a good resource covering all aspects of writing packages in R.
During this course, we recommend using tools in RStudio and the
usethis
package for easy package development. In doing so,
a standard package structure is automatically generated for you. Here
are some links that might be useful:
- .gitignore: contains regular expressions that should be ignored by Git, more info here
- .Rbuildignore: contains regular expressions that should be ignored by R CMD check / when building the package from source, more info here
- demo/: contains R demo files, more info here (which we’ve populated with d0105_run_birth_death.R, the script from Practical 1-5)
- DESCRIPTION: contains metadata about your package, more info here
- man/: contains code used to generate documentation when the package is built (don’t edit these files, this process will be automated), more info here
- NAMESPACE: contains the names of imported and exported functions (don’t edit this file either), more info here
- R/: contains code used to generate functions when the package is built (which we’ve populated with step_deterministic_birth_death.R, the step function from Practical 1-5), more info here
- README.md: contains markdown used to generate your GitHub repository readme page, more info here
- githubusername.Rproj: an RStudio project file, which is used to make this directory an RStudio project, and can be used as a shortcut for opening this project from your filesystem, more info here