A Glossary
You can use the glossary()
function to automatically link to a term in the psyTeachR glossary or make your own project-specific glossary.
This will create a link to the glossary and include a tooltip with a short definition when you hover over the term. Use the following syntax in inline r: glossary("word")
. For example, common data types are integer, double, and character.
If you need to link to a definition, but are using a different form of the word, add the display version as the second argument (display
). You can also override the automatic short definition by providing your own in the third argument (def
). Add the argument link = FALSE
if you just want the hover definition and not a link to the psyTeachR glossary.
glossary("data type",
display = "Data Types",
def = "My custom definition of data types",
link = FALSE)
[1] "Data Types"
You can add a glossary table to the end of a chapter with the following code. It creates a table of all terms used in that chapter previous to the glossary_table()
function. It uses kableExtra()
, so if you use it in a code chunk, set results='asis'
.
```{r, echo=FALSE, results='asis'}
glossary_table()
```
term | definition |
---|---|
character | A data type representing strings of text. |
data type | My custom definition of data types |
double | A data type representing a real decimal number |
integer | A data type representing whole numbers. |
If you want to contribute to the glossary, fork the github project, add your terms and submit a pull request, or suggest a new term at the issues page.