# Program Flow in readJDX In readJDX: Import Data in the JCAMP-DX Format

library("readJDX")
suppressPackageStartupMessages(library("kableExtra"))
rm(list = ls())

set.seed(999)
knitr::opts_chunk$set(tidy = TRUE, fig.height = 7, fig.width = 7, fig.fullwidth = TRUE, echo = FALSE)  This vignette is based on readJDX version r desc$Version.

# Program Flow

readJDX is coded in such a way that it should be easy to add features. Contributions to improve or expand the package, including pull requests, are always welcome! Table \ref{tab:PF} shows the overall flow of the function calls. Only a couple of these functions are exported, so take a look at the source code for documentation. Be sure to check out the MiniDIFDUP_1 and MiniDIFDUP_2 vignettes for additional information about the JCAMP-DX file structure and how readJDX functions extract the data.

fName <- c(
"- findVariableLists",
"- extractParams",
"- processVariableList",
"- - processXYY", # 5
"- - - decompLines",
"- - - - getComp",
"- - - - unSQZ",
"- - - - insertDUPs",
"- - - - - repDUPs", # 10
"- - - - deDIF",
"- - - - - unDIF",
"- - - - yValueCheck",
"- - processPT"
)

fInput <- c(
"file name",
"character vector: all lines from original file",
"character vector: just the metadata lines",
"character vector: a single VL",
"character vector: a single VL", # 5
"character vector: a single VL",
"character vector: a single VL",
"character vector: named with the ASDF mode, called via lapply",
"character vector: named with the ASDF mode, called via lapply",
"a string of length one", # 10
"*list* of character vectors from a single VL; the character vectors are named with the ASDF mode, the list is named with line numbers",
"character vector: one line from VL, entries named by ASDF code",
"*list* of character vectors from a single VL; the character vectors are named with the ASDF mode, the list is named with line numbers",
"character vector: a single VL"
)

DF <- data.frame(fName, fInput)
names(DF) <- c("function", "input")

kable(DF, "latex", booktabs = TRUE, caption = "Program Flow.\\label{tab:PF}") %>% kable_styling(latex_options = c("striped", "hold_position")) %>% footnote(general = c("VL stands for variable list, as defined in the JCAMP-DX standard. For examples see the *MiniDIFDUP_1* vignette."))