-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
108 lines (78 loc) · 3.53 KB
/
README.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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
suppressPackageStartupMessages(require("devtools"))
suppressPackageStartupMessages(require("usethis"))
suppressPackageStartupMessages(require("pkgdown"))
suppressPackageStartupMessages(require("covr"))
```
# test
<!-- badges: start -->
[![Codecov test coverage](https://codecov.io/gh/Karim-Mane/test/branch/master/graph/badge.svg)](https://app.codecov.io/gh/Karim-Mane/test?branch=master)
<!-- badges: end -->
The goal of test is to provide functions that are useful for the creation of an R package.
## Installation
You can install the development version of test from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Karim-Mane/test")
```
## Loading the package after installation
```{r example}
library(test)
```
## Create an R project and link it with a remote GitHub account
The **createPackage()** function is used to create an R project and link it to a remote GitHub account and perform the first commit to that account. The function requires the following parameters:
1. `package.name`: the name of the package/project to be created
2. `where`: the path to the directory where package will be created
3. `organisation.name`: the name of the organisation in which the package will be created. For **Epiverse TRACE**, this will be `epiverse-trace`. For Karim's github account, this will be `Karim-Mane`
```{r eval=FALSE}
createPackage(package.name="test",
where="/Users/km28/Documents/Karim/Karim/LSHTM/Codes",
organisation.name="Karim-Mane")
```
## Set up the package components
Use the **setUpPackageComponents()** to set up the package components i.e. to:
* set up a licence,
* create a Readme file,
* set up unit testing infrastructure,
* set up a pkgdown website,
```{r eval=FALSE}
setUpPackageComponents()
```
## Build and update the Readme.md from the README.Rmd
To build the Readme.md file from the README.Rmd file, use the **updateReadMe()**. This function needs to be called after any modification of the README.Rmd file.
```{r eval=FALSE}
updateReadMe()
```
## Build the package website
The package website can be built using the **pkgdown** package in R. After editing all your functions and documentation files, use the **buildPkgdownWebsite()** function to build the website.
```{r eval=FALSE}
buildPkgdownWebsite()
```
## Add list of package dependencies
Once identified, the list of packages on which the current package depends on can will be added to the **DESCRIPTION** file using the **addPkgDepencies()** function. The function expects the following parameters:
1. `dependencies`: a vector of packages on which the package to be built depends on
```{r eval=FALSE}
addPkgDepencies(dependencies=c("devtools","usethis","pkgdown","covr"))
```
## Build the package documentation
When you are satisfied with the documentation of all the functions, use the **buildPkgDocumentation()** to build the documentation files in the `man/` folder and update the **NAMESPACE** file.
```{r eval=FALSE}
buildPkgDocumentation()
```
## Commit and push the changes to the remote GitHub account
For any changes/updates made on any of the files of the package use the command below to update the remote GitHub account.
```{bash eval=FALSE}
git add .
git commit -a -m "updates"
git push origin master
```