library(dverse)
library(admiral)
library(admiraldev)
library(admiralonco)
library(admiralophtha)
library(admiralpeds)
library(admiralvaccine)
library(dplyr)
library(DT)This article shows how to create a global search for any collection of R packages, i.e. a universe. Your universe may be on CRAN, large, and popular like the tidyverse or pharmaverse. But it may also be not on CRAN, small, company-specific or personal.
The example here uses the ‘admiralverse’ – a toy universe defined as every package on CRAN today (2024-12-07), with a website, and a name starting with ‘admiral’.
You need:
- the package
{dverse}to document your universe, - each package in the toy ‘admiralverse’ to access the documentation metadata,
{dplyr}to manipulate the output of{dverse}, and{DT}to create a searchable table.
Versions
packageVersion("dverse")
## [1] '0.2.0'
packageVersion("admiral")
## [1] '1.3.1'
packageVersion("admiraldev")
## [1] '1.3.1'
packageVersion("admiralonco")
## [1] '1.3.0'
packageVersion("admiralophtha")
## [1] '1.3.0'
packageVersion("admiralpeds")
## [1] '0.2.1'
packageVersion("admiralvaccine")
## [1] '0.5.0'
packageVersion("dplyr")
## [1] '1.1.4'
packageVersion("DT")
## [1] '0.34.0'dverse::document_universe() takes the names of the packages in the ‘admiralverse’, and a template pointing to each help file (topic) in each package.
admiralverse <- c(
"admiral",
"admiraldev",
"admiralonco",
"admiralophtha",
"admiralpeds",
"admiralvaccine"
)
# For example: https://pharmaverse.github.io/admiral/reference/queries.html
template <- "https://pharmaverse.github.io/{package}/reference/{topic}.html"
docs <- dverse::document_universe(admiralverse, template)
docs
## # A tibble: 375 × 7
## topic alias title concept type keyword package
## <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 <a href=https://pharmaverse.github… %>% Pipe… reexpo… help <NA> admiral
## 2 <a href=https://pharmaverse.github… %not… Nega… dev_ut… help <NA> admira…
## 3 <a href=https://pharmaverse.github… %or% Or dev_ut… help <NA> admira…
## 4 <a href=https://pharmaverse.github… adbc… Crea… <NA> vign… <NA> admira…
## 5 <a href=https://pharmaverse.github… adce Crea… <NA> vign… <NA> admira…
## 6 <a href=https://pharmaverse.github… add_… Add … quo help <NA> admira…
## 7 <a href=https://pharmaverse.github… adfa… Crea… <NA> vign… <NA> admira…
## 8 <a href=https://pharmaverse.github… adis Crea… <NA> vign… <NA> admira…
## 9 <a href=https://pharmaverse.github… adju… Adju… <NA> help intern… admiral
## 10 <a href=https://pharmaverse.github… admi… admi… intern… help intern… admiral
## # ℹ 365 more rowsYou may need to exclude some topics, such as reexported objects from other packages. Because topics outside your universe yield broken links, you can exclude them with dverse::is_online().
docs |> filter(!dverse::is_online(topic))
## # A tibble: 29 × 7
## topic alias title concept type keyword package
## <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 <a href=https://pharmaverse.github… %>% Pipe… reexpo… help <NA> admiral
## 2 <a href=https://pharmaverse.github… %not… Nega… dev_ut… help <NA> admira…
## 3 <a href=https://pharmaverse.github… %or% Or dev_ut… help <NA> admira…
## 4 <a href=https://pharmaverse.github… adju… Adju… <NA> help intern… admiral
## 5 <a href=https://pharmaverse.github… adrs… Crea… <NA> vign… <NA> admira…
## 6 <a href=https://pharmaverse.github… anti… Join… joins help <NA> admira…
## 7 <a href=https://pharmaverse.github… asse… Asse… <NA> help intern… admiral
## 8 <a href=https://pharmaverse.github… asse… Chec… <NA> help intern… admiral
## 9 <a href=https://pharmaverse.github… asse… Asse… <NA> help intern… admiral
## 10 <a href=https://pharmaverse.github… asse… Asse… <NA> help intern… admiral
## # ℹ 19 more rows
online <- docs |> filter(dverse::is_online(topic))Consider the different kinds of documentation in your universe.
online |> count(type, keyword)
## # A tibble: 5 × 3
## type keyword n
## <chr> <chr> <int>
## 1 help datasets 22
## 2 help documentation 3
## 3 help internal 37
## 4 help <NA> 244
## 5 vignette <NA> 40You may organize the documentation however you like. For inspiration see the pactaverse, the toy ‘admiralverse’, fgeo and tidymodels.
Here it makes sense to place vignettes, datasets, and public functions in separate tables.
Vignettes
Here are all the vignettes available across packages in the ‘admiralverse’. Click on each topic to read its corresponding vignette.
vignettes <- online |> filter(type == "vignette")
vignettes |>
distinct(topic, title, package) |>
datatable(escape = FALSE)You don’t see what you expect?
This works with vignettes but not articles, so usethis::use_vignette() not usethis::use_article().
When you install the packages in your universe ensure to install the vignettes. Vignettes install by default when you install your packages from CRAN with
install.packages()or pak::pak(). But if you install them from source with devtools::install() or remotes::install_github(), then you needbuild_vignettes = TRUE.
Datasets
Here are all the datasets. Click on each topic to read about it.
datasets <- online |> filter(keyword == "datasets")
datasets |>
distinct(topic, title, package) |>
datatable(escape = FALSE)Functions
Here are all the functions. Click on each topic to read about it.
internal <- online |> filter(keyword == "internal")
public <- online |>
anti_join(vignettes) |>
anti_join(datasets) |>
anti_join(internal)
public |>
distinct(topic, title, package) |>
datatable(escape = FALSE)Learn More
To learn more see the toy ‘admiralverse’ meta-package – which models the main use case of {dverse}.
You may also enjoy these videos:
- Creating a meta-package for the toy ‘admiralverse’ (5’).
- Creating a website for the toy ‘admiralverse’ (9’).
Was this useful? Do you want to report bugs, propose changes or request features?.
Last updated
2025-11-13 18:27:37.276022
Details
Reuse
Citation
@online{lepore2024,
author = {Lepore, Mauro},
title = {Creating a Better Universe with Dverse},
date = {2024-12-13},
url = {https://pharmaverse.github.io/blog/posts/2024-12-13_document_yo.../document_your_universe_with_dverse.html},
langid = {en}
}