decompLines: Decompress the Data Lines in a JCAMP-DX File

View source: R/decompLines.R

decompLinesR Documentation

Decompress the Data Lines in a JCAMP-DX File


This function is used by the package, and can also be called by the user who wishes to study problematic lines in a file in a standalone manner. See the examples.


decompLines(VL, debug = 0)



Character. The variable list to be processed as a character vector. Depending upon the mode and the stage of processing:

  • the lines may be named as "Line_1" etc

  • a format code may be present as the first entry

  • there may be other non-numeric lines that eventually get stripped off


Integer. See readJDX for details.


A list of numeric strings, the result of unpacking the compressed data. One list element is returned for each line. The numeric string is named with the ASDF compression mode.


Each individual line passed here is converted to a list to make processing and naming the pieces easier.The individual entries are named according to their original ASDF compression code. Unless otherwise noted all functions called from here should act on a list of lines, via lapply. Note too that the X values are present, e.g. X, Y1, Y2 ... Yn.


AFFN is separated by any amount of white space so processing is straightforward, as exponents are handled automatically, and white space stripped off automatically, courtesy of R internals. It appears AFFN is never mixed with other formats. The other formats are collectively called ASDF in the standard.


testLines1 <- c(
demo1 <- decompLines(testLines1, debug = 6)

testLines2 <- c(
  # EU AFFN:
  "1898,58486802541 -0,0170190036296844 -0,0170874372124672 -0,0171865783631802",
  "1917,23501403401 -0,0176097713410854 -0,0177919361740351 -0,0179808251559734",
  # AFFN with fixed field width/extra space:
  "           16383       2259260      -5242968      -7176216      -1616072",
  "           16379      10650432       4373926      -3660824       2136488"

demo2 <- decompLines(testLines2, debug = 6)

readJDX documentation built on Nov. 19, 2023, 1:08 a.m.