R6ClassDocuStatus: R6 Class Representing Document Status Objects

Description Usage Format Value Fields Public Methods Private Methods Examples

Description

R6ClassDocuStatus objects can be used to represent the status of a given document. A core requirement is that the different status records should be persistent across different compilation runs. That makes it necessary to store the intermediate states of an R6ClassDocuStatus object in a file. Given that requirement we must have methods for reading status information from a file and for writing status information to a file. Furthermore, we need a method to add a document status record and we must be able to display all document status records as a table.

Usage

1

Format

R6Class object.

Value

Object of R6Class with methods for managing the status of a document.

Fields

version

current version of the document

status_colnames

vector of column names shown in the document table

status_history

dataframe with the document history read from the history file

history_file

name of the file containing the document history

Public Methods

new()

This method instantiates an object of class R6ClassDocuStatus

initialize(psFormat)

Initialization after creating the instance. Reads history file if it exists

include_doc_stat(psTitle)

Saves updated document status to the status file. Write section header psTitle for document status and write markdown table containing the document status.

set_current_status(psVersion, psDate, psAuthor, psProject)

Main method for setting status information in a Rmarkdown source document. Status information consists of version, date, author, status description and project. All theses components are passed to the method as arguments. In case there exists document status history, it is assumed that it is available in private$status_history. If status history is not empty, the current status is row-bound to the status history. If the version number of the current status already exists, then we assume that an existing entry should be updated. The date of a status entry is only updated, if it is explicitly set as method argument psDate, otherwise, the existing date is used.

Private Methods

writeStatusToFile()

Writes current status and history to a tab-separated file. Tab-separated format is chosen, because TAB-characters are less likely to occur in any of the table fields. File encoding is set to "UTF-8" in order to preserve German Umlauts

readStatusFromFile()

Document status history is read from the history file.

readCsv2StatusFromFile()

Reading method for old csv2 formatted status history files. This is mainly used for converting history files from old csv2 format to new tab-separated format.

knitr_kable

Complete status history is written to a table using knitr::kable to convert the dataframe into a markdown-table

auto_increment()

Autoincrementing minor version number

Examples

1
2
3
4
5
6
7
8
9
r6objDocuStat <- R6ClassDocuStatus$new()
r6obj_docstat$set_current_status(psVersion = "0.0.908",
                                 psStatus  = "New version of setting document status",
                                 psProject = "rmddochelper")
## Not run: 
r6objDocuStat$writeStatusToFile()
r6objDocuStat$knitr_kable()

## End(Not run)

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