-
Notifications
You must be signed in to change notification settings - Fork 0
/
usethis_setup.Rmd
123 lines (86 loc) · 2.64 KB
/
usethis_setup.Rmd
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
title: "usethis_setup"
output: html_document
---
# This file was used to create and strucuture the GitHub repo, but should NOT be run again, I only include it here for reference
```{r}
library("here")
library("usethis")
library("devtools")
```
# Create package
```r
create_package(here())
usethis::use_mit_license()
```
```{r}
# use dplyr pipe
usethis::use_pipe(export = FALSE)
# use logo
usethis::use_logo("logo.png", geometry = "250x250", retina = TRUE)
# use vignette
usethis::use_vignette("wingen-vignette")
# creates testing structure
usethis::use_testthat()
# Creates and modifies external data for use in package
usethis::use_data_raw()
```
```{r}
# Ignore stuff
usethis::use_build_ignore("paperex/simex")
usethis::use_build_ignore("paperex/empex")
# currently the vcf files are large so if you don't ignore the external data it takes a while to install the package
usethis::use_build_ignore("inst/extdata/")
usethis::use_build_ignore("data-raw")
usethis::use_build_ignore("README_cache/")
usethis::use_build_ignore("vignettes/wingen-vignette_cache/")
usethis::use_build_ignore("vignettes/wingen-vignette_files/")
usethis::use_build_ignore(".gitignore")
usethis::use_build_ignore(".github")
```
#CI/GitHub actions
https://github.com/r-lib/actions/tree/master/examples
## Quickstart CI workflow
```{r}
usethis::use_github_action("check-release")
```
This workflow installs latest release R version on macOS and runs R CMD check via the rcmdcheck package. If this is the first time you have used CI for a project this is probably what you want to use.
## Standard CI workflow
```{r}
usethis::use_github_action("check-standard")
```
This workflow runs R CMD check via the rcmdcheck package on the three major OSs (linux, macOS and Windows) with the current, development, and previous versions of R. If you plan to someday submit your package to CRAN or Bioconductor this is likely the workflow you want to use.
When should you use it?
You plan to submit your package to CRAN or Bioconductor
Your package has OS-specific code
## Code coverage
```{r}
usethis::use_coverage(type = "codecov")
# NOTE: modified the yml file so that tests would only be run when R files or tests changed
use_github_action("test-coverage")
```
```{r}
# run codecov and make badge
# note: the cov_token.R file is not stored on github
source(here::here("cov_token.R"))
covr::codecov(token = cov_token())
```
# renv
```{r}
#renv::init()
renv::snapshot()
renv::clean()
```
# install and check package
```{r}
devtools::install()
devtools::check()
```
# Fix package style (!use with caution!)
```{r}
styler::style_pkg()
```
# check package name
```{r}
available::available("wingen")
```