library(fs)
library(dplyr)
library(purrr)

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rdtest

R-CMD-check lint

Overview

r packageDescription("rdtest", fields = "Title"): r packageDescription("rdtest", fields = "Description")

Notebooks

Notebooks in this package:

rmd_metadata <- function(filename) {
  # get notebook yaml
  yfm <- rmarkdown::yaml_front_matter(filename)

  # get notebook 'description' line - first non-blank line after front matter
  # warning: assumes the document has valid front matter bounded by ^---$
  notebook <- readLines(filename)
  header <- grep("^---$", notebook)
  body_start <- header[2] + 1
  body_end <- length(notebook)
  desc_line <- grep("[:graph:]", notebook[body_start:body_end])[1] + header[2]

  gh_url <- paste0(
    desc::desc_get_urls()[1], "/", fs::path_ext_remove(fs::path_file(filename)), ".html"
  )

  list(title = yfm$title, url = gh_url, date = yfm$date, description = notebook[desc_line])
}

notebooks <- dir_ls("analysis", glob = "*.Rmd") |>
  map_dfr(rmd_metadata) |>
  mutate(bullet = paste0(
    "- [", title, "](", url, ") (", date, "): ", description
  )) |>
  pull(bullet)

writeLines(notebooks)

Installation

You can install the development version of rdtest from GitHub with:

# install.packages("devtools")
devtools::install_github("jabenninghoff/rdtest")

Or using renv:

# install.packages("renv")
renv::install("jabenninghoff/rdtest")

Development



jabenninghoff/rdtest documentation built on Jan. 19, 2022, 12:05 a.m.