forked from COMBINE-Australia/r-pkg-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
103 lines (79 loc) · 3.51 KB
/
index.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
---
title: "R 팩키지 워크샵"
subtitle: "호주 R 팩키지 워크샵 (2019)"
site: bookdown::bookdown_site
output: bookdown::gitbook
documentclass: book
biblio-style: apalike
link-citations: yes
description: |
These are the materials for the R package development workshop created by
COMBINE, an association for Australian students in bioinformatics,
computational biology and related fields.
This workshop explains the basics of R package development and takes you
through the steps to create a minimal R package.
---
```{r knitr, include = FALSE}
knitr::opts_chunk$set(
eval = FALSE
)
```
# Preface {-}
## About this workshop {-}
This workshop was created by COMBINE, an association for Australian students in
bioinformatics, computational biology and related fields. You can find out
more about COMBINE at http://combine.org.au.
The goal of this workshop is to explain the basics of R package development. By
the end of the workshop you should have your own minimal R package that you can
use to store your personal functions.
The materials were written using the **bookdown** package
(https://bookdown.org/home/), which is built on top of R Markdown and **knitr**.
## Requirements {-}
The workshop assumes that you are familar with basic R and the RStudio IDE. This
includes topics such as installing packages, assigning variables and writing
functions. If you are not comfortable with these you may need to complete an
introductory R workshop first.
### R and RStudio {-}
You will need a recent version of R and RStudio. These materials were written
using `r R.version.string` and RStudio version
`r rstudioapi::versionInfo()$version`. You can download R from
https://cloud.r-project.org/ and RStudio from
https://www.rstudio.com/products/rstudio/download/.
### Packages {-}
The main packages used in the workshop are below with the versions used in these
materials:
* **devtools** (v`r packageVersion("devtools")`)
* **usethis** (v`r packageVersion("usethis")`)
* **roxygen2** (v`r packageVersion("roxygen2")`)
* **testthat** (v`r packageVersion("testthat")`)
* **knitr** (v`r packageVersion("knitr")`)
* **ggplot2** (v`r packageVersion("ggplot2")`)
* **rlang** (v`r packageVersion("rlang")`)
Please make sure these packages are installed before starting the workshop. You
can install them by running the following code.
```{r}
pkgs <- c("devtools", "usethis", "roxygen2", "testthat", "knitr", "ggplot2",
"rlang")
install.packages(pkgs)
```
### Build tools {-}
Some stages of the package development process can require other programs to be
installed on your computer. To check that you have everything you need run the
following function in R (after installing the packages above).
```{r}
pkgbuild::check_build_tools()
```
This function will check if you have the build tools installed and prompt you
to install them if you don't.
### GitHub {-}
Version control using git is very useful and should be part of your package
development process but it is outside the scope of this workshop. However,
uploading your package to code sharing websites such as GitHub is the easiest
way to distribute it. Towards the end of the workshop is a section showing you
to upload your package to GitHub using R commands (no knowledge of git
necessary). If you would like to try this and don't already have a GitHub
account please create one at https://github.com/join.
## License {-}
These materials are covered by the Creative Commons Attribution 4.0
International (CC BY 4.0) license
(https://creativecommons.org/licenses/by/4.0/).