Chapter 3 R package set up
Building R packages requires that Rtools be installed.
Additionally, there are several R packages that will be required throughout the workflow.
1. devtools
2. usethis
3. roxygen
Data import and analysis packages will be discussed in later sections.
3.1 Basic package initialization
- From RStudio, select “create new project” -> “New Directory” -> “New R Package”. It is recommended that during this process a git repo also be created.
- Edit the DESCRIPTION file. At this point you can do a build and reload to check the package structure is working.
- Create a README file (
usethis::use_readme_rmd
). Edit details as required. Render the document to create the README.md file that is used by github to display project details on the repo start up page.
- FishNet2 archive files are stored in a special directory (data-raw) that will be ignored in the package build process. This allows the package structure to be self-contained but not included in the distributed package files. The directory structure is created using (
usethis::use_data_raw()
).
The package structure is now complete. Successive steps will be discussed in the following chapters.