Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patzaw/glossary
Simple glossary management for R/Rmd
https://github.com/patzaw/glossary
Last synced: about 2 months ago
JSON representation
Simple glossary management for R/Rmd
- Host: GitHub
- URL: https://github.com/patzaw/glossary
- Owner: patzaw
- Created: 2021-04-23T06:56:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-30T12:48:33.000Z (over 3 years ago)
- Last Synced: 2024-08-13T07:11:36.210Z (5 months ago)
- Language: R
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - patzaw/glossary - Simple glossary management for R/Rmd (R)
README
---
title: "README"
output:
md_document:
variant: gfm
toc: true
toc_depth: 2
editor_options:
chunk_output_type: console
---```{r setup, include = FALSE}
library(knitr)
```# Introduction
This small script allows the management of simple glossaries.
## Dependencies
This script depends on the following packages:
```{r, include=FALSE}
library(magrittr)
library(dplyr)
library(glue)
library(reactable)
``````{r, eval=FALSE}
library(magrittr)
library(dplyr)
library(glue)
library(reactable)
```# Use
## Load and create a glossary
```{r}
source("glossary.R")
glossary <- create_glossary()
```## Add terms in the glossary
```{r}
glossary$add_term(
"UMI",
"Unique Molecular Identifier. Each PCR primer is associated to a UMI to identify PCR duplicates when quantifying the transcripts. Therefore the number of counts corresponds to the number of UMI which is the quantification measure per feature."
)
```Synonyms can also be provided:
```{r}
glossary$add_term(
"MT",
"Genes coded by mitochondrial genome. MT (%) corresponds to the percentage of UMI corresponding to mitochondrial genes."
)
glossary$add_synonyms("MT", "MT (%)")
```## Showing the glossary
- `glossary$get_table()` returns the glossary tibble
- `glossary$view()` shows the glossary in a reactable## Get definitions
The following function is used to get the definitions of terms of interest.
It's case insensitive and support plurals by default.```{r}
glossary$get_definitions(c("mt", "UMIs"))
```In an markdown or html document, the definitions can be shown in tooltips
using the `glossary$get_html_definitions()` function.
For example: `r glossary$get_html_definitions("UMIs")`.
CSS style can be customized using the `style` parameter
(Unfortunately, CSS are not rendered in GitHub markdown as it is a part of the
sanitization process).To make it easier to use in an Rmd document in RStudio this function can
be copied in a function with a shorter name such as:```{r}
td <- glossary$get_html_definitions
```And then the following
markdown [snippet](https://support.rstudio.com/hc/en-us/articles/204463668-Code-Snippets)
can be added in RStudio (Edit Snippets button in Global Options -> Code):```
snippet td
`r${2} td(${1})`
```