generated from posit-conf-2023/workshop-template
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocumentation.qmd
133 lines (95 loc) · 2.09 KB
/
documentation.qmd
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
123
124
125
126
127
128
129
130
131
132
133
---
title: "Documentation 📓"
---
### Add a roxygen block just above your function definition
Insert template with `Ctrl + Alt + Shift + R` or `Cmd + Option + Shift + R`
``` r
#' R Library Summary
#'
#' Provides a brief summary of the package libraries on your machine
#'
#' @return A data.frame containing the count of packages in each of the user's
#' libraries
#' @export
#'
#' @examples
#' lib_summary()
lib_summary <- function() {
...
}
```
### Build function documentation (`man/lib_summary.Rd`) from roxygen
```{r}
document()
```
You can preview it with `?function_name`
```{r}
load_all()
?lib_summary
```
### Check package to ensure documentation conforms to standards
```{r}
check()
```
## Create package-level documentation
```{r}
use_package_doc()
document()
```
See rendered documentation at `man/libminer2-package.Rd`
Preview and check again
```{r}
load_all()
?libminer
check()
```
### Install your package
```{r}
install()
library(libminer)
lib_summary() # note one more package than before - that's yours!
```
## README
```{r}
use_readme_rmd()
```
````
---
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%"
)
```
# libminer
<!-- badges: start -->
<!-- badges: end -->
The goal of libminer is to provide an overview of your R library setup. It is a toy
package created as a part of a workshop and not meant for serious use.
## Installation
You can install the development version of libminer from [GitHub](https://github.com/) with:
```r
# install.packages("devtools")
devtools::install_github("ateucher/libminer")
```
## Example usage
To get a count of installed packages in each of your library locations,
optionally with the total sizes, use the `lib_summary()` function:
```{{r example}}
library(libminer)
lib_summary()
# specify `sizes = TRUE` to calculate the total size on disk of your packages
lib_summary(sizes = TRUE)
```
````
```{r}
build_readme()
```
```{r}
check()
```