
Create a data frame with documentation metadata of one or more packages
Source:R/document_universe.R
document_universe.RdCreate a data.frame with documentation metadata of one or more packages. If you develop a universe, such as the tidyverse or tidymodels, dverse helps you to easily create a universe-wide reference for the pkgdown website of your meta-package.
Arguments
- x
A character vector giving concepts or package names to match.
- url_template
Character. A template to generate links to documentation, using the syntax of
glue::glue()to indicate where to insert the values from the columnspackageandtopic. The template may have lengh 1 or 2:If the template is a vector has length 1, the template should point to the manual (a.k.a. "reference" or "index"), i.e. the online version of the help files that you can otherwise access locally with
?, e.g.:
"https://{package}.tidyverse.org/reference/{topic}.html"In this case, the template for vignettes is automatically constructed by replacing
/reference/with/articles/, e.g.:"https://{package}.tidyverse.org/articles/{topic}.html"If this is invalid, then you'll need to provide a vector of length 2.
If the template is a vector has length 2, the first element should point to the manual (see above), and the second element should point to vignettes, e.g.:
c( "https://{package}.tidyverse.org/reference/{topic}.html", "https://{package}.tidyverse.org/articles/{topic}.html" )
Examples
# Pretend this is the universe we want to document
library(glue)
library(tibble)
universe <- c("glue", "tibble")
document_universe(universe)
#> # A tibble: 46 × 7
#> topic alias title concept type keyword package
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 add_column add_column Add … additi… help NA tibble
#> 2 add_row add_row, add_case Add … additi… help NA tibble
#> 3 as_glue as_glue Coer… NA help NA glue
#> 4 as_tibble as_tibble, as_tibble_row, as_… Coer… NA help NA tibble
#> 5 char char, set_char_opts Form… vector… help NA tibble
#> 6 deprecated deprecated, data_frame, tibbl… Depr… NA help intern… tibble
#> 7 digits digits Comp… NA vign… NA tibble
#> 8 enframe enframe, deframe Conv… NA help NA tibble
#> 9 engines engines Cust… NA vign… NA glue
#> 10 extending extending Exte… NA vign… NA tibble
#> # ℹ 36 more rows
# Adding links the online manual and vignettes
template <- "https://{package}.tidyverse.org/reference/{topic}.html"
document_universe(universe, template)
#> # A tibble: 46 × 7
#> topic alias title concept type keyword package
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 <a href=https://tibble.tidyverse.o… add_… Add … additi… help NA tibble
#> 2 <a href=https://tibble.tidyverse.o… add_… Add … additi… help NA tibble
#> 3 <a href=https://glue.tidyverse.org… as_g… Coer… NA help NA glue
#> 4 <a href=https://tibble.tidyverse.o… as_t… Coer… NA help NA tibble
#> 5 <a href=https://tibble.tidyverse.o… char… Form… vector… help NA tibble
#> 6 <a href=https://tibble.tidyverse.o… depr… Depr… NA help intern… tibble
#> 7 <a href=https://tibble.tidyverse.o… digi… Comp… NA vign… NA tibble
#> 8 <a href=https://tibble.tidyverse.o… enfr… Conv… NA help NA tibble
#> 9 <a href=https://glue.tidyverse.org… engi… Cust… NA vign… NA glue
#> 10 <a href=https://tibble.tidyverse.o… exte… Exte… NA vign… NA tibble
#> # ℹ 36 more rows
# Adding an explicit template for vignettes
template <- c(
"https://{package}.tidyverse.org/reference/{topic}.html",
"https://{package}.tidyverse.org/articles/{topic}.html"
)
document_universe(universe, template)
#> # A tibble: 46 × 7
#> topic alias title concept type keyword package
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 <a href=https://tibble.tidyverse.o… add_… Add … additi… help NA tibble
#> 2 <a href=https://tibble.tidyverse.o… add_… Add … additi… help NA tibble
#> 3 <a href=https://glue.tidyverse.org… as_g… Coer… NA help NA glue
#> 4 <a href=https://tibble.tidyverse.o… as_t… Coer… NA help NA tibble
#> 5 <a href=https://tibble.tidyverse.o… char… Form… vector… help NA tibble
#> 6 <a href=https://tibble.tidyverse.o… depr… Depr… NA help intern… tibble
#> 7 <a href=https://tibble.tidyverse.o… digi… Comp… NA vign… NA tibble
#> 8 <a href=https://tibble.tidyverse.o… enfr… Conv… NA help NA tibble
#> 9 <a href=https://glue.tidyverse.org… engi… Cust… NA vign… NA glue
#> 10 <a href=https://tibble.tidyverse.o… exte… Exte… NA vign… NA tibble
#> # ℹ 36 more rows
# Works beyond GitHub Pages, e.g. on r-universe
template <- c(
"https://tidyverse.r-universe.dev/{package}/doc/manual.html#{topic}",
"https://tidyverse.r-universe.dev/articles/{package}/{topic}.html"
)
document_universe(universe, template)
#> # A tibble: 46 × 7
#> topic alias title concept type keyword package
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 <a href=https://tidyverse.r-univer… add_… Add … additi… help NA tibble
#> 2 <a href=https://tidyverse.r-univer… add_… Add … additi… help NA tibble
#> 3 <a href=https://tidyverse.r-univer… as_g… Coer… NA help NA glue
#> 4 <a href=https://tidyverse.r-univer… as_t… Coer… NA help NA tibble
#> 5 <a href=https://tidyverse.r-univer… char… Form… vector… help NA tibble
#> 6 <a href=https://tidyverse.r-univer… depr… Depr… NA help intern… tibble
#> 7 <a href=https://tidyverse.r-univer… digi… Comp… NA vign… NA tibble
#> 8 <a href=https://tidyverse.r-univer… enfr… Conv… NA help NA tibble
#> 9 <a href=https://tidyverse.r-univer… engi… Cust… NA vign… NA glue
#> 10 <a href=https://tidyverse.r-univer… exte… Exte… NA vign… NA tibble
#> # ℹ 36 more rows