R6ClassTableAbbrev: R6 Class To Model Abbreviation Table Objects

Description Usage Format Value Fields Public methods Examples

Description

Abbreviation tables are tables with two columns one of which contains the abbreviations and the second column contains the meaning of the abbreviations. The tables are specific for a given document. The R6 class defined here provides functionlity to automatically collect all abbreviations together with the associated meanings and to generate the resulting table of abbreviations. Method add_abbrev is used to add new abbreviations. At the end of a document the list of collected abbreviations together with their meanings is written to a file. This file is the source for automatically generating the table of abbreviations. Since, we want to allow for including the table of abbreviations at any position within the document, two compilation runs are required when new abbreviations are added to the list of abbreviations. The first run collects all abbreviations and writes them to the file and the second run is used to generate the table of abbreviations.

Usage

1

Format

An object of class R6ClassGenerator of length 24.

Value

R6 Object of type R6ClassTableAbbrev with fields and methods to collect abbreviations and generate a table of abbreviations

Fields

dfAbbrTable

dataframe with abbreviations

colHeader

column header for table of abbreviations

sAbbrFile

name of the file where abbreviations are written to

sAbbrTitle

title to be used in document above table of abbreviations

bQuote

flag whether to put text in quotes

Public methods

new()

Instantiation of R6 object of class R6ClassTableAbbrev

setColHeader(pvColHeader)

setter for column header

setAbbrFile

setter for abbreviation file

setAbbrTitle

setter for abbreviation title

setQuote

setter for bQuote flag

add_abbrev(psAbbrev,psMeaning,psShowText=NULL,pbQuote=NULL,pbOut=TRUE)

add new pair of abbreviation(psAbbrev) and meaning(psMeaning) to list of abbreviations. In case psShowText is not null, use it to be shown in the text, otherwise use psMeaning in the text. Flag pbQuote determines whether abbreviation and meaning are enclosed in quotes. Flag pbOut determines whether abbreviation and meaning should be written to Rmarkdown source file.

writeToTsvFile

Write list of abbreviations in tab-separated format to file

include_abbr_table

Include table of abbreviations in a document

is_empty_abbr

Check whether list of abbreviations is empty

Examples

1
2
3
4
5
6
7
8
r6objAbr <- R6ClassTableAbbrev$new()
r6objAbr$setAbbrFile(psAbbrFile = "ABBREVIATIONS")
r6objAbr$add_abbrev(psAbbrev = "Abr", psMeaning = "Abbreviation")
## Not run: 
r6objAbr$writeToTsvFile()
r6objAbr$include_abbr_table()

## End(Not run)

charlotte-ngs/rmddochelper documentation built on June 27, 2019, 1:22 a.m.