knitr::opts_chunk$set(echo = FALSE, message = FALSE)
The vcdExtra
package contains r nrow(vcdExtra::datasets(package="vcdExtra"))
datasets illustrating
various methods of categorical data analysis and visualization performed with the package.
These have been classified according to the method of analysis and are presented here with links to the
help file for each.
library(dplyr) library(tidyr) library(readxl) #library(here)
#setwd(here()) dsets_tagged <- read_excel(here::here("extra", "vcdExtra-datasets.xlsx"), sheet="vcdExtra-datasets") #' The `tags` sheet contain the `tag` and a `topic` description tags <- read_excel(here::here("extra", "vcdExtra-datasets.xlsx"), sheet="tags")
dsets_tagged <- dsets_tagged |> dplyr::select(-Title, -dim) |> dplyr::rename(dataset = Item) #' to invert the table, need to split tags into separate observations dset_split <- dsets_tagged |> tidyr::separate_longer_delim(tags, delim = ";") |> dplyr::mutate(tag = stringr::str_trim(tags)) |> dplyr::select(-tags) #' ## collapse the rows for the same tag tag_dset <- dset_split |> arrange(tag) |> dplyr::group_by(tag) |> dplyr::summarise(datasets = paste(dataset, collapse = "; ")) |> ungroup() # join with tag descriptions tag_dset <- tag_dset |> left_join(tags, by = "tag") |> dplyr::relocate(topic, .after = tag)
add_links <- function(dsets, sep = "; ") { names <- stringr::str_split_1(dsets, sep) names <- glue::glue("[{names}](help({names}))") glue::glue_collapse(names, sep = sep) } tag_dset |> dplyr::select(-tag) |> dplyr::mutate(datasets = purrr::map(datasets, add_links)) |> knitr::kable()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.