knitr::opts_chunk$set(
  echo = TRUE,
  message = FALSE,
  warning = FALSE,
  collapse = TRUE,
  comment = "#>"
)

WARNING: This reference may be out of date. It aims to demonstrate pkgdoc -- not to provide a search tool for the tidyverse.

library(pkgdoc)
library(tidyverse)
library(glue)
library(DT)

Let's pull the documentation of all core-tidyverse-packages with pkgdoc.

(docs <- reference_package(tidyverse:::core))

reference_package() and reference_concept() include the argument url but currently it only works if all packages are under the same GitHub organization and the url is formatted as https://{organization}.github.io/{package}/. But we can create arbitrary links easily with glue::glue().

link_topic <- function(package, topic) {
  glue("<a href=https://{package}.tidyverse.org/reference/{topic}>{topic}</a>")
}

link_package <- function(package) {
  glue("<a href=https://{package}.tidyverse.org/index.html>{package}</a>")
}

linked <- docs %>% 
  mutate(
    topic   = link_topic(package, topic),
    package = link_package(package)
)

linked

We are now read to create a searchable table with DT::datatable().

linked %>% 
  datatable(
    escape = FALSE,
    rownames = NULL,
    options = list(
      # f: filter, t: table, i: information
      dom = "fti",
      search = list(search = "filter")
    )
  )


maurolepore/pkgdoc documentation built on Nov. 4, 2024, 6:56 a.m.