-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_package_steps.R
99 lines (66 loc) · 2.34 KB
/
create_package_steps.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This script records the steps used to create the package
# This script follows the steps in the cheatsheet below
# https://www.rstudio.com/wp-content/uploads/2015/06/devtools-cheatsheet.pdf
library(devtools)
library(usethis)
## Package Structure
# Ignore this file
usethis::use_build_ignore("create_package_steps.R")
## Setup
# Add the following line to DESCRIPTION to support .rda file compression
# Depends: R (>= 2.10)
# Use packages needed by functions, vignettes, etc.
usethis::use_package("vegan", "Imports")
usethis::use_package("dplyr", "Imports")
usethis::use_package("assertthat", "Imports")
usethis::use_package("ggplot2", "Imports")
usethis::use_package("reshape2", "Imports")
usethis::use_package("ggrepel", "Imports")
## Write Code
# Periodically lint the code
devtools::lint()
## Test
# Create the testing infrastructure
usethis::use_testthat()
# Run the tests
devtools::test()
## Document
# Add roxygen2 comments to .R files
# Delete the original NAMESPACE file (document() will recreate)
devtools::document()
# Add qpdf.exe to the path to compress pdf's to resolve R CMD CHECK warnings
## Add Data
# Create the /data-raw folder and add to .Rbuildignore
usethis::use_data_raw()
# Use the Create_package_data.Rmd file to process package data
# Add the sin_flowline_points sp object to the package
usethis::use_data(individuals, overwrite = TRUE)
usethis::use_data(listed, overwrite = TRUE)
## Organize
# Update the package documentation
devtools::document()
## Teach
# Create the vignette infrastructure
usethis::use_vignette()
# Build the vignette (re-run after each set of edits)
usethis::build_vignettes()
## Check
# Use devtools::check() as RStudio check fails when repository is stored on a
# network drive
devtools::check()
## Continuous Integration
# https://bookdown.org/rdpeng/RProgDA/continuous-integration.html
# Use travis to test on Linux
devtools::use_travis()
# Use AppVeyor to test on Windows
devtools::use_appveyor()
# Check status of Travis CI builds
# https://travis-ci.org/mpdougherty/RegionalCurve
# Check status of AppVeyor builds
# https://ci.appveyor.com/project/mpdougherty/regionalcurve
# Check status of test code coverage
# https://codecov.io/gh/mpdougherty/RegionalCurve
## Check
# Use package goodpractice to check package
library(goodpractice)
goodpractice::gp("X:/Work/Office/Regional/ERDC/EMRRP_Sediment/Methods/fgm")