-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference-chirunconf.Rmd
93 lines (74 loc) · 2.83 KB
/
reference-chirunconf.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
---
title: "Demo for chirunconf"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Demo for chirunconf}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE,
collapse = TRUE,
comment = "#>"
)
```
This document shows how to use [pkgdoc](https://maurolepore.github.io/pkgdoc/) to organize, search, and link documentation from multiple R packages -- all in one page. pkgdoc complements existing tools. It is similar to [RDocumentation](https://www.rdocumentation.org) but not limited to packages published on CRAN. It is also similar to the _Reference_ section of [pkgdown](https://pkgdown.r-lib.org/) websites but is not limited to a single package.
pkgdoc may be used to centralize R packages developed during Chicago R Unconference. Suppose that during chirunconf [Emily Riederer](https://github.com/EmilyRiederer) and [Alex Hayes](https://github.com/alexpghayes) developed the packages projmgr and formulize. This document shows some ways you could use pkgdoc to show Emily's and Alex's work.
```{r}
library(dplyr)
library(projmgr)
library(formulize)
```
With pkgdoc + `DT::datatable()` you can create searchable widgets. For example, you can show the packages by different authors (or groups).
### A package by Emily
```{r}
# Organization that serves the websites all all packages
# (Not really -- this is just a toy example)
chirunconf <- "https://maurolepore.github.io/"
pkgdoc::reference_package("projmgr", url = chirunconf) %>%
DT::datatable(
escape = FALSE,
rownames = NULL,
options = list(search = list(search = "issues"))
)
```
### A package by Alex
```{r}
pkgdoc::reference_package("formulize", url = chirunconf) %>%
DT::datatable(
escape = FALSE,
rownames = NULL,
options = list(search = list(search = ""))
)
```
With pkgdoc + `knitr::kable()` you can create a static table with clickable links. Here for example we group features across multiple packages by concept (create concepts with the tag `#' @family`)
### `#' @family chirunconf`
(The concept 'chirunconf' was created for this demo only.)
```{r}
pkgdoc::reference_concept("chirunconf", url = chirunconf) %>%
knitr::kable()
```
With the kableExtra package we can tweak the output like the 'Reference' section of a [pkgdown](https://pkgdown.r-lib.org/) website.
### `#' @family chirunconf`
```{r, warning=FALSE}
nice_kable <- function(x) {
x %>%
select(-package, -concept) %>%
unique() %>%
knitr::kable(
x,
format = "html",
col.names = NULL,
escape = FALSE
) %>%
kableExtra::column_spec(1, bold = TRUE) %>%
kableExtra::column_spec(2, width = "20em")
}
pkgdoc::reference_concept("chirunconf", url = chirunconf) %>%
nice_kable()
```