# Continuous Flow Examples

#### 2021-02-15

# Introduction

Isoreader supports several continuous flow IRMS data formats. This vignette shows some of the functionality for continuous flow files. For additional information on operations more generally (caching, combining read files, data export, etc.), please consult the operations vignette. For details on downstream data processing and visualization, see the isoprocessor package.

    # load isoreader package
    library(isoreader)

# Reading files

Reading continuous flow files is as simple as passing one or multiple file or folder paths to the `iso_read_continuous_flow()` function. If folders are provided, any files that have a recognized continuous flow file extensions within those folders will be processed (e.g. all `.dxf`, `.cf` and `.iarc`). Here we read several files that are bundled with the package as examples (and whose paths can be retrieved using the `iso_get_reader_example()` function). Note that some of the files (.cf, .dxf) are individual analysis files whereas others (.iarc) are collections of several files.

    # all available examples
    iso_get_reader_examples() %>% knitr::kable()

filename | type | software | description
--- | --- | --- | ---
continuous_flow_example.cf | continuous flow | Isodat | Continuous Flow file format (older)
continuous_flow_example.dxf | continuous flow | Isodat | Continuous Flow file format (newer)
continuous_flow_example.iarc | continuous flow | ionOS | Continuous Flow data archive
dual_inlet_example.caf | dual inlet | Isodat | Dual Inlet file format (older)
dual_inlet_example.did | dual inlet | Isodat | Dual Inlet file format (newer)
dual_inlet_nu_example.txt | dual inlet | Nu | Dual Inlet file format
background_scan_example.scn | scan | Isodat | Scan file format
full_scan_example.scn | scan | Isodat | Scan file format
peak_shape_scan_example.scn | scan | Isodat | Scan file format
time_scan_example.scn | scan | Isodat | Scan file format

    # read a few of the continuous flow examples
    cf_files <-
      iso_read_continuous_flow(
        iso_get_reader_example("continuous_flow_example.cf"),
        iso_get_reader_example("continuous_flow_example.iarc"),
        iso_get_reader_example("continuous_flow_example.dxf")
      )
    #> Info: preparing to read 3 data files (all will be cached)...
    #> Info: reading file 'continuous_flow_example.cf' with '.cf' reader...
    #> Info: reading file 'continuous_flow_example.iarc' with '.iarc' reader...
    #>       unpacking isoprime archive file...
    #>       found 1 processing list(s) in .iarc: 'ProcessingList_1'
    #>       found 2 method(s) in .iarc: 'Method_320', 'Method_77'
    #>       found 4 sample(s) in .iarc
    #>       searching processing list 'ProcessingList_1' for gas configurations...
    #>       found configurations for 'CO', 'SO2', 'CO2', 'H2', 'N2'
    #>       processing sample '6632_WSL-2 wood' (IRMS data '133.hdf5', '135.hdf5')
    #>       processing sample '6605_USGS41' (IRMS data '40.hdf5', '43.hdf5')
    #>       processing sample '6617_IAEA600' (IRMS data '80.hdf5', '82.hdf5')
    #>       processing sample '6630_GlutamicAcid04' (IRMS data '124.hdf5', '126.h...
    #> Info: reading file 'continuous_flow_example.dxf' with '.dxf' reader...
    #> Info: finished reading 3 files in 6.04 secs

# File summary

The `cf_files` variable now contains a set of isoreader objects, one for each file. Take a look at what information was retrieved from the files using the `iso_get_data_summary()` function.

    cf_files %>% iso_get_data_summary() %>% knitr::kable()
    #> Info: aggregating data summary from 6 data file(s)

file_id | raw_data | file_info | method_info | vendor_data_table | file_path
--- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 8605 time points, 2 ions (2,3) | 21 entries | standards, resistors | 19 rows, 25 columns | continuous_flow_example.cf
6632_WSL-2 wood | 1952 time points, 3 ions (45,46,44) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_0b7e6b49-7756-4cca-b387-4d6617cb28e6
6605_USGS41 | 2387 time points, 2 ions (29,28) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_0e08e8b4-c625-4fd7-bf5b-9f4823f660cd
6617_IAEA600 | 1796 time points, 3 ions (45,46,44) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_1de1fdc3-0797-4e44-8357-52acbd0d4a6d
6630_GlutamicAcid04 | 2386 time points, 2 ions (29,28) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_261a3286-0bc6-4aca-bba2-183c02597d8b
continuous_flow_example.dxf | 2435 time points, 6 ions (28,29,30,44,45,46) | 21 entries | standards, resistors | 6 rows, 60 columns | continuous_flow_example.dxf

## Problems

In case there was any trouble with reading any of the files, the following functions provide an overview summary as well as details of all errors and warnings, respectively. The examples here contain no errors but if you run into any unexpected file read problems, please file a bug report in the isoreader issue tracker.

    cf_files %>% iso_get_problems_summary() %>% knitr::kable()

file_id | error | warning
--- | --- | ---

    cf_files %>% iso_get_problems() %>% knitr::kable()

file_id | type | func | details
--- | --- | --- | ---

# File Information

Detailed file information can be aggregated for all isofiles using the `iso_get_file_info()` function which supports the full select syntax of the dplyr package to specify which columns are of interest (by default, all file information is retrieved). Additionally, file information from different file formats can be renamed to the same column name for easy of downstream processing. The following provides a few examples for how this can be used (the names of the interesting info columns may vary between different file formats):

    # all file information
    cf_files %>% iso_get_file_info(select = c(-file_root)) %>% knitr::kable()
    #> Info: aggregating file info from 6 data file(s), selecting info columns 'c(-file_root)'

file_id | file_path | file_subpath | file_datetime | file_size | Line | Peak Center | GC Method | AS Sample | AS Method | Identifier 1 | Identifier 2 | Analysis | Comment | Preparation | Pre Script | Post Script | Method | H3 Factor | MS_integration_time.s | GlobalIdentifier | Name | Id | AcquisitionStartDate | AcquisitionEndDate | CompletionState | MethodId | ProcessingListTypeIdentifier | Dilution Type | EA Method | EA Sample Weight | Row | Check Ref. Dilution | H3 Stability | Type | measurement_info
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | continuous_flow_example.cf | NA | 2013-07-13 17:42:40 | 550462 | 19 | NA | Sebastian8.gcm | 98 | >Internal No 3 | F8-5.5uL | NA | 6520 | NA | NA | NA | NA | Sebastian\20130624_F8_CH4.met | 2.79431047797221 | 0.2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
6632_WSL-2 wood | continuous_flow_example.iarc | Task_0b7e6b49-7756-4cca-b387-4d6617cb28e6 | 2014-10-08 12:27:23 | 662269 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 0b7e6b49-7756-4cca-b387-4d6617cb28e6 | WSL-2 wood | 6632 | 2014-10-08T18:27:23.4682755 | 2014-10-08T18:43:40.1319321 | Success | 320 | {BC89E456-57C0-4FF1-9110-90C8E6AE1B69} | Wood - 25 mg | 10mg120sIRMS | 29 | NA | NA | NA | NA | NA
6605_USGS41 | continuous_flow_example.iarc | Task_0e08e8b4-c625-4fd7-bf5b-9f4823f660cd | 2014-10-08 08:14:35 | 662269 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 0e08e8b4-c625-4fd7-bf5b-9f4823f660cd | USGS41 | 6605 | 2014-10-08T14:14:35.9865192 | 2014-10-08T14:24:49.0288173 | Success | 77 | {BC89E456-57C0-4FF1-9110-90C8E6AE1B69} | Glutamic Acid - 1mg | 05mg70sIRMS_fast | 1 | NA | NA | NA | NA | NA
6617_IAEA600 | continuous_flow_example.iarc | Task_1de1fdc3-0797-4e44-8357-52acbd0d4a6d | 2014-10-08 10:01:14 | 662269 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 1de1fdc3-0797-4e44-8357-52acbd0d4a6d | IAEA600 | 6617 | 2014-10-08T16:01:14.8274991 | 2014-10-08T16:11:29.4289531 | Success | 77 | {BC89E456-57C0-4FF1-9110-90C8E6AE1B69} | Caffeine - 0.4mg | 05mg70sIRMS_fast | 0.4 | NA | NA | NA | NA | NA
6630_GlutamicAcid04 | continuous_flow_example.iarc | Task_261a3286-0bc6-4aca-bba2-183c02597d8b | 2014-10-08 12:00:50 | 662269 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | 261a3286-0bc6-4aca-bba2-183c02597d8b | GlutamicAcid04 | 6630 | 2014-10-08T18:00:50.7420188 | 2014-10-08T18:11:05.9675352 | Success | 77 | {BC89E456-57C0-4FF1-9110-90C8E6AE1B69} | Glutamic Acid - 1mg | 05mg70sIRMS_fast | 1 | NA | NA | NA | NA | NA
continuous_flow_example.dxf | continuous_flow_example.dxf | NA | 2017-02-09 12:55:40 | 370497 | NA | 1 | NA | NA | NA | acetanilide_1 | 0.428 | 2921 | 11 | A5 | NA | NA | N2 CO2 85%.met | 0 | 0.2 | NA | NA | NA | NA | NA | NA | NA | NA | NA | N2 CO2 test.eam | NA | 5 | 0 | 0 | Sample | Set Sample Dilution to 0 [%] , Sample dilution: 000 0 , Set Reference Dilution to 69 [%] , Peak Center found at [59732] , Sample Dilution found at 0 [] , Set Sample Dilution to 0 [%] , Sample dilution: 000 0 , Detector Signal added: Ret:145.171[sec] Ampl:2321 [mV] : 12:47:38 N2, Set Reference Dilution to 57 [%] , Set Sample Dilution to 89 [%] , Sample dilution: 001 1

    # select file information
    cf_files %>%
      iso_get_file_info(
        select = c(
           # rename sample id columns from the different file types to a new ID column
          ID = `Identifier 1`, ID = `Name`,
          # select columns without renaming
          Analysis, `Peak Center`, `H3 Factor`,
          # select the time stamp and rename it to `Date & Time`
          `Date & Time` = file_datetime
        ),
        # explicitly allow for file specific rename (for the new ID column)
        file_specific = TRUE
      ) %>% knitr::kable()
    #> Info: aggregating file info from 6 data file(s), selecting info columns 'c(ID = `Identifier 1`, ID = Name, Analysis, `Peak Center`, `H3 Factor`, `Date & Time` = file_datetime)'

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time
--- | --- | --- | --- | --- | ---
continuous_flow_example.cf | F8-5.5uL | 6520 | NA | 2.79431047797221 | 2013-07-13 17:42:40
6632_WSL-2 wood | WSL-2 wood | NA | NA | NA | 2014-10-08 12:27:23
6605_USGS41 | USGS41 | NA | NA | NA | 2014-10-08 08:14:35
6617_IAEA600 | IAEA600 | NA | NA | NA | 2014-10-08 10:01:14
6630_GlutamicAcid04 | GlutamicAcid04 | NA | NA | NA | 2014-10-08 12:00:50
continuous_flow_example.dxf | acetanilide_1 | 2921 | 1 | 0 | 2017-02-09 12:55:40

## Select/Rename

Rather than retrieving specific file info columns using the above example of `iso_get_file_info(select = ...)`, these information can also be modified across an entire collection of isofiles using the `iso_select_file_info()` and `iso_rename_file_info()` functions. For example, the above example could be similarly achieved with the following use of `iso_select_file_info()`:

    # select + rename specific file info columns
    cf_files2 <- cf_files %>%
      iso_select_file_info(
        ID = `Identifier 1`, ID = `Name`, Analysis, `Peak Center`, `H3 Factor`,
        `Date & Time` = file_datetime,
        # recode to the same name in different files
        `Sample Weight` = `Identifier 2`, `Sample Weight` = `EA Sample Weight`,
        file_specific = TRUE
      )
    #> Info: selecting/renaming the following file info:
    #>  - for 4 file(s): 'file_id', 'Name'->'ID', 'file_datetime'->'Date & Time', 'EA Sample Weight'->'Sample Weight'
    #>  - for 2 file(s): 'file_id', 'Identifier 1'->'ID', 'Analysis', 'Peak Center', 'H3 Factor', 'file_datetime'->'Date & Time', 'Identifier 2'->'Sample Weight'

    # fetch all file info
    cf_files2 %>% iso_get_file_info() %>% knitr::kable()
    #> Info: aggregating file info from 6 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | F8-5.5uL | 6520 | NA | 2.79431047797221 | 2013-07-13 17:42:40 | NA
6632_WSL-2 wood | WSL-2 wood | NA | NA | NA | 2014-10-08 12:27:23 | 29
6605_USGS41 | USGS41 | NA | NA | NA | 2014-10-08 08:14:35 | 1
6617_IAEA600 | IAEA600 | NA | NA | NA | 2014-10-08 10:01:14 | 0.4
6630_GlutamicAcid04 | GlutamicAcid04 | NA | NA | NA | 2014-10-08 12:00:50 | 1
continuous_flow_example.dxf | acetanilide_1 | 2921 | 1 | 0 | 2017-02-09 12:55:40 | 0.428

## Filter

Any collection of isofiles can also be filtered based on the available file information using the function `iso_filter_files`. This function can operate on any column available in the file information and supports full dplyr syntax.

    # find files that have 'acetanilide' in the new ID field
    cf_files2 %>% iso_filter_files(grepl("acetanilide", ID)) %>%
      iso_get_file_info() %>%
      knitr::kable()
    #> Info: applying file filter, keeping 1 of 6 files
    #> Info: aggregating file info from 1 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.dxf | acetanilide_1 | 2921 | 1 | 0 | 2017-02-09 12:55:40 | 0.428

    # find files that were run since 2015
    cf_files2 %>%
      iso_filter_files(`Date & Time` > "2015-01-01") %>%
      iso_get_file_info() %>%
      knitr::kable()
    #> Info: applying file filter, keeping 1 of 6 files
    #> Info: aggregating file info from 1 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.dxf | acetanilide_1 | 2921 | 1 | 0 | 2017-02-09 12:55:40 | 0.428

## Mutate

The file information in any collection of isofiles can also be mutated using the function `iso_mutate_file_info`. This function can introduce new columns and operate on any existing columns available in the file information (even if it does not exist in all files) and supports full dplyr syntax. It can also be used in conjunction with `iso_with_unit` to generate values with implicit units.

    cf_files3 <-
      cf_files2 %>%
      iso_mutate_file_info(
        # update existing column
        ID = paste("ID:", ID),
        # introduce new column
        `Run since 2015?` = `Date & Time` > "2015-01-01",
        # parse weight as a number and turn into a column with units
        `Sample Weight` = `Sample Weight` %>% parse_number() %>% iso_with_units("mg")
      )
    #> Info: mutating file info for 6 data file(s)

    cf_files3 %>%
      iso_get_file_info() %>%
      iso_make_units_explicit() %>%
      knitr::kable()
    #> Info: aggregating file info from 6 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight [mg] | Run since 2015?
--- | --- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | ID: F8-5.5uL | 6520 | NA | 2.79431047797221 | 2013-07-13 17:42:40 | NA | FALSE
6632_WSL-2 wood | ID: WSL-2 wood | NA | NA | NA | 2014-10-08 12:27:23 | 29.000 | FALSE
6605_USGS41 | ID: USGS41 | NA | NA | NA | 2014-10-08 08:14:35 | 1.000 | FALSE
6617_IAEA600 | ID: IAEA600 | NA | NA | NA | 2014-10-08 10:01:14 | 0.400 | FALSE
6630_GlutamicAcid04 | ID: GlutamicAcid04 | NA | NA | NA | 2014-10-08 12:00:50 | 1.000 | FALSE
continuous_flow_example.dxf | ID: acetanilide_1 | 2921 | 1 | 0 | 2017-02-09 12:55:40 | 0.428 | TRUE

## Add

Additionally, a wide range of new file information can be added in the form of a data frame with any number of columns (usually read from a comma-separated-value/csv file or an Excel/xlsx file) using the function `iso_add_file_info` and specifying which existing file information should be used to merge in the new information. It is similar to dplyr’s left_join but with additional safety checks and the possibility to join the new information sequentially as illustrated below.

    # this kind of information data frame is frequently read in from a csv or xlsx file
    new_info <-
      dplyr::bind_rows(
        # new information based on new vs. old samples
        dplyr::tribble(
          ~file_id, ~`Run since 2015?`,  ~process,  ~info,
           NA,       TRUE,                "yes",     "new runs",
           NA,       FALSE,               "yes",     "old runs"
        ),
        # new information for a single specific file
        dplyr::tribble(
          ~file_id,        ~process,  ~note,
           "6617_IAEA600",  "no",      "did not inject properly"
        )
      )
    new_info %>% knitr::kable()

file_id | Run since 2015? | process | info | note
--- | --- | --- | --- | ---
NA | TRUE | yes | new runs | NA
NA | FALSE | yes | old runs | NA
6617_IAEA600 | NA | no | NA | did not inject properly

    # adding it to the isofiles
    cf_files3 %>%
      iso_add_file_info(new_info, by1 = "Run since 2015?", by2 = "file_id") %>%
      iso_get_file_info(select = !!names(new_info)) %>%
      knitr::kable()
    #> Info: adding new file information ('process', 'info', 'note') to 6 data file(s), joining by 'Run since 2015?' then 'file_id'...
    #>  - 'Run since 2015?' join: 2/2 new info rows matched 6/6 data files - 1 of these was/were also matched by subsequent joins which took precedence
    #>  - 'file_id' join: 1/1 new info rows matched 1/6 data files
    #> Info: aggregating file info from 6 data file(s), selecting info columns 'file_id', 'Run since 2015?', 'process', 'info', 'note'

file_id | Run since 2015? | process | info | note
--- | --- | --- | --- | ---
continuous_flow_example.cf | FALSE | yes | old runs | NA
6632_WSL-2 wood | FALSE | yes | old runs | NA
6605_USGS41 | FALSE | yes | old runs | NA
6617_IAEA600 | FALSE | no | NA | did not inject properly
6630_GlutamicAcid04 | FALSE | yes | old runs | NA
continuous_flow_example.dxf | TRUE | yes | new runs | NA

## Parse

Most file information is initially read as text to avoid cumbersome specifications during the read process and compatibility issues between different IRMS file formats. However, many file info columns are not easily processed as text. The isoreader package therefore provides several parsing and data extraction functions to facilitate processing the text-based data (some via functionality implemented by the readr package). See code block below for examples. For a complete overview, see the `?extract_data` and `?iso_parse_file_info` documentation.

    # use parsing and extraction in iso_mutate_file_info
    cf_files2 %>%
      iso_mutate_file_info(
        # change type of Peak Center to logical
        `Peak Center` = parse_logical(`Peak Center`),
        # retrieve first word of file_id
        file_id_1st = extract_word(file_id),
        # retrieve second word of ID column
        file_id_2nd = extract_word(file_id, 2),
        # retrieve file extension from the file_id using regular expression
        name = extract_substring(ID, "(\\w+)-?(.*)?", capture_bracket = 1)
      ) %>%
      iso_get_file_info(select = c(matches("file_id"), ID, name, `Peak Center`)) %>%
      knitr::kable()
    #> Info: mutating file info for 6 data file(s)
    #> Info: aggregating file info from 6 data file(s), selecting info columns 'c(matches("file_id"), ID, name, `Peak Center`)'

file_id | file_id_1st | file_id_2nd | ID | name | Peak Center
--- | --- | --- | --- | --- | ---
continuous_flow_example.cf | continuous | flow | F8-5.5uL | F8 | NA
6632_WSL-2 wood | 6632 | WSL | WSL-2 wood | WSL | NA
6605_USGS41 | 6605 | USGS41 | USGS41 | USGS41 | NA
6617_IAEA600 | 6617 | IAEA600 | IAEA600 | IAEA600 | NA
6630_GlutamicAcid04 | 6630 | GlutamicAcid04 | GlutamicAcid04 | GlutamicAcid04 | NA
continuous_flow_example.dxf | continuous | flow | acetanilide_1 | acetanilide_1 | TRUE

    # use parsing in iso_filter_file_info
    cf_files2 %>%
      iso_filter_files(parse_number(`H3 Factor`) > 2) %>%
      iso_get_file_info() %>%
      knitr::kable()
    #> Info: applying file filter, keeping 1 of 6 files
    #> Info: aggregating file info from 1 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | F8-5.5uL | 6520 | NA | 2.79431047797221 | 2013-07-13 17:42:40 | NA

    # use iso_parse_file_info for simplified parsing of column data types
    cf_files2 %>%
      iso_parse_file_info(
        integer = Analysis,
        number = `H3 Factor`,
        logical = `Peak Center`
      ) %>%
      iso_get_file_info() %>%
      knitr::kable()
    #> Info: parsing 3 file info columns for 6 data file(s):
    #>  - to integer: 'Analysis'
    #>  - to logical: 'Peak Center'
    #>  - to number: 'H3 Factor'
    #> Info: aggregating file info from 6 data file(s)

file_id | ID | Analysis | Peak Center | H3 Factor | Date & Time | Sample Weight
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | F8-5.5uL | 6520 | NA | 2.79431 | 2013-07-13 17:42:40 | NA
6632_WSL-2 wood | WSL-2 wood | NA | NA | NA | 2014-10-08 12:27:23 | 29
6605_USGS41 | USGS41 | NA | NA | NA | 2014-10-08 08:14:35 | 1
6617_IAEA600 | IAEA600 | NA | NA | NA | 2014-10-08 10:01:14 | 0.4
6630_GlutamicAcid04 | GlutamicAcid04 | NA | NA | NA | 2014-10-08 12:00:50 | 1
continuous_flow_example.dxf | acetanilide_1 | 2921 | TRUE | 0.00000 | 2017-02-09 12:55:40 | 0.428

# Resistors

Additionally, some IRMS data files contain resistor information that are useful for downstream calculations (see e.g. section on signal conversion later in this vignette):

    cf_files %>% iso_get_resistors() %>% knitr::kable()
    #> Info: aggregating resistors info from 6 data file(s)

file_id | cup | R.Ohm | mass
--- | --- | --- | ---
continuous_flow_example.cf | 1 | 1e+09 | 2
continuous_flow_example.cf | 2 | 1e+12 | 3
continuous_flow_example.dxf | 1 | 3e+08 | 28
continuous_flow_example.dxf | 2 | 3e+10 | 29
continuous_flow_example.dxf | 3 | 1e+11 | 30
continuous_flow_example.dxf | 1 | 3e+08 | 44
continuous_flow_example.dxf | 2 | 3e+10 | 45
continuous_flow_example.dxf | 3 | 1e+11 | 46

# Reference values

As well as isotopic reference values for the different gases:

    # reference delta values without ratio values
    cf_files %>% iso_get_standards(file_id:reference) %>% knitr::kable()
    #> Info: aggregating standards info from 6 data file(s)

file_id | standard | gas | delta_name | delta_value | reference
--- | --- | --- | --- | --- | ---
continuous_flow_example.cf | methane ref | H2 | d 2H/1H | -151.9 | VSMOW
continuous_flow_example.dxf | N2_zero | N2 | d 15N/14N | 0.0 | Air-N2
continuous_flow_example.dxf | CO2_zero | CO2 | d 13C/12C | 0.0 | VPDB
continuous_flow_example.dxf | CO2_zero | CO2 | d 18O/16O | 0.0 | VSMOW

    # reference values with ratios
    cf_files %>% iso_get_standards() %>% knitr::kable()
    #> Info: aggregating standards info from 6 data file(s)

file_id | standard | gas | delta_name | delta_value | reference | element | ratio_name | ratio_value
--- | --- | --- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | methane ref | H2 | d 2H/1H | -151.9 | VSMOW | H | R 2H/1H | 0.0001558
continuous_flow_example.cf | methane ref | H2 | d 2H/1H | -151.9 | VSMOW | O | R 17O/16O | 0.0003799
continuous_flow_example.cf | methane ref | H2 | d 2H/1H | -151.9 | VSMOW | O | R 18O/16O | 0.0020052
continuous_flow_example.dxf | N2_zero | N2 | d 15N/14N | 0.0 | Air-N2 | N | R 15N/14N | 0.0036782
continuous_flow_example.dxf | CO2_zero | CO2 | d 13C/12C | 0.0 | VPDB | C | R 13C/12C | 0.0111802
continuous_flow_example.dxf | CO2_zero | CO2 | d 13C/12C | 0.0 | VPDB | O | R 18O/16O | 0.0020672
continuous_flow_example.dxf | CO2_zero | CO2 | d 13C/12C | 0.0 | VPDB | O | R 17O/16O | 0.0003860
continuous_flow_example.dxf | CO2_zero | CO2 | d 18O/16O | 0.0 | VSMOW | H | R 2H/1H | 0.0001558
continuous_flow_example.dxf | CO2_zero | CO2 | d 18O/16O | 0.0 | VSMOW | O | R 17O/16O | 0.0003799
continuous_flow_example.dxf | CO2_zero | CO2 | d 18O/16O | 0.0 | VSMOW | O | R 18O/16O | 0.0020052

# Raw Data

The raw data read from the IRMS files can be retrieved similarly using the `iso_get_raw_data()` function. Most data aggregation functions also allow for inclusion of file information using the `include_file_info` parameter, which functions identically to the `select` parameter of the `iso_get_file_info` function discussed earlier.

    # get raw data with default selections (all raw data, no additional file info)
    cf_files %>% iso_get_raw_data() %>% head(n=10) %>% knitr::kable()
    #> Info: aggregating raw data from 6 data file(s)

file_id | tp | time.s | v2.mV | v3.mV | i45.nA | i46.nA | i44.nA | i29.nA | i28.nA | v28.mV | v29.mV | v30.mV | v44.mV | v45.mV | v46.mV
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 1 | 0.209 | 194.5682 | 60.01971 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 2 | 0.418 | 194.5418 | 60.04760 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 3 | 0.627 | 194.5365 | 60.21315 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 4 | 0.836 | 194.5630 | 59.91891 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 5 | 1.045 | 194.5735 | 59.71668 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 6 | 1.254 | 194.5444 | 59.69523 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 7 | 1.463 | 194.5153 | 59.58589 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 8 | 1.672 | 194.5233 | 59.72385 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 9 | 1.881 | 194.5096 | 59.73885 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 10 | 2.090 | 194.5206 | 59.73885 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA

    # get specific raw data and add some file information
    cf_files %>%
      iso_get_raw_data(
        # select just time and the m/z 2 and 3 ions
        select = c(time.s, v2.mV, v3.mV),
        # include the Analysis number fron the file info and rename it to 'run'
        include_file_info = c(run = Analysis)
      ) %>%
      # look at first few records only
      head(n=10) %>% knitr::kable()
    #> Info: aggregating raw data from 6 data file(s), selecting data columns 'c(time.s, v2.mV, v3.mV)', including file info 'c(run = Analysis)'

file_id | run | time.s | v2.mV | v3.mV
--- | --- | --- | --- | ---
continuous_flow_example.cf | 6520 | 0.209 | 194.5682 | 60.01971
continuous_flow_example.cf | 6520 | 0.418 | 194.5418 | 60.04760
continuous_flow_example.cf | 6520 | 0.627 | 194.5365 | 60.21315
continuous_flow_example.cf | 6520 | 0.836 | 194.5630 | 59.91891
continuous_flow_example.cf | 6520 | 1.045 | 194.5735 | 59.71668
continuous_flow_example.cf | 6520 | 1.254 | 194.5444 | 59.69523
continuous_flow_example.cf | 6520 | 1.463 | 194.5153 | 59.58589
continuous_flow_example.cf | 6520 | 1.672 | 194.5233 | 59.72385
continuous_flow_example.cf | 6520 | 1.881 | 194.5096 | 59.73885
continuous_flow_example.cf | 6520 | 2.090 | 194.5206 | 59.73885

# Data Processing

The isoreader package is intended to make raw stable isotope data easily accessible. However, as with most analytical data, there is significant downstream processing required to turn these raw intensity chromatograms into peak-specific, properly referenced isotopic measurements. This and similar functionality as well as data visualization is part of the isoprocessor package which takes isotopic data through the various corrections in a transparent, efficient and reproducible manner.

That said, most vendor software also performs some of these calculations and it can be useful to be able to compare new data reduction procedures against those implemented in the vendor software. For this purpose, isoreader retrieves vendor computed data tables whenever possible, as illustrated below.

## Vendor Data Table

As with most data retrieval functions, the `iso_get_vendor_data_table()` function also allows specific column selection (by default, all columns are selected) and easy addition of file information via the `include_file_info` parameter (by default, none is included).

    # entire vendor data table
    cf_files %>% iso_get_vendor_data_table() %>% knitr::kable()
    #> Info: aggregating vendor data table from 6 data file(s)

file_id | Nr. | Start | Rt | End | Ampl 2 | Ampl 3 | BGD 2 | BGD 3 | rIntensity 2 | rIntensity 3 | rIntensity All | Intensity 2 | Intensity 3 | Intensity All | List First Peak | rR 3H2/2H2 | Is Ref.? | R 3H2/2H2 | Ref. Name | rd 3H2/2H2 | d 3H2/2H2 | R 2H/1H | d 2H/1H | AT% 2H/1H | Rps 3H2/2H2 | Ampl 28 | Ampl 29 | Ampl 30 | Ampl 44 | Ampl 45 | Ampl 46 | BGD 28 | BGD 29 | BGD 30 | BGD 44 | BGD 45 | BGD 46 | rIntensity 28 | rIntensity 29 | rIntensity 30 | Intensity 28 | Intensity 29 | Intensity 30 | Sample Dilution | rR 29N2/28N2 | R 29N2/28N2 | rd 29N2/28N2 | d 29N2/28N2 | R 15N/14N | d 15N/14N | AT% 15N/14N | Rps 29N2/28N2 | rIntensity 44 | rIntensity 45 | rIntensity 46 | Intensity 44 | Intensity 45 | Intensity 46 | rR 45CO2/44CO2 | rR 46CO2/44CO2 | R 45CO2/44CO2 | rd 45CO2/44CO2 | d 45CO2/44CO2 | R 46CO2/44CO2 | rd 46CO2/44CO2 | d 46CO2/44CO2 | R 13C/12C | d 13C/12C | AT% 13C/12C | R 18O/16O | d 18O/16O | AT% 18O/16O | R 17O/16O | d 17O/16O | Rps 45CO2/44CO2 | Rps 46CO2/44CO2
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 1 | 283.404 | 286.330 | 293.018 | 3977.902 | 1075.2188 | 194.4964 | 59.91891 | 18553.91 | 4854.296 | 23408.20 | 18.55391 | 0.004854296 | 18.55876 | 1 | 0.2616320 | 0 | 0.0002614 | methane ref | -10.587034 | -160.8789 | 0.0001307 | -160.8789 | 0.01306760 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 2 | 318.307 | 321.233 | 327.921 | 3978.824 | 1076.2768 | 194.6741 | 59.72170 | 18558.22 | 4858.212 | 23416.43 | 18.55822 | 0.004858212 | 18.56307 | NA | 0.2617823 | 0 | 0.0002615 | methane ref | -10.018742 | -160.3969 | 0.0001308 | -160.3969 | 0.01307511 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 3 | 606.309 | 611.952 | 634.942 | 4992.800 | 1374.8432 | 216.3650 | 65.39321 | 24397.80 | 6433.988 | 30831.79 | 24.39780 | 0.006433988 | 24.40423 | NA | 0.2637118 | 0 | 0.0002635 | methane ref | -2.721810 | -154.2084 | 0.0001317 | -154.2084 | 0.01317147 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 4 | 666.083 | 671.517 | 699.314 | 4906.356 | 1351.9323 | 229.7344 | 69.24248 | 24374.92 | 6445.498 | 30820.41 | 24.37492 | 0.006445498 | 24.38136 | NA | 0.2644316 | 1 | 0.0002642 | methane ref | 0.000000 | -151.9000 | 0.0001321 | -151.9000 | 0.01320741 | 0.0003115 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 5 | 740.696 | 747.802 | 768.075 | 5227.052 | 1176.7574 | 229.8024 | 69.13564 | 18309.28 | 4462.697 | 22771.98 | 18.30928 | 0.004462697 | 18.31375 | NA | 0.2437396 | 0 | 0.0002436 | methane ref | -78.076804 | -218.1169 | 0.0001218 | -218.1169 | 0.01217635 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 6 | 801.515 | 809.457 | 829.312 | 5044.300 | 1126.9858 | 229.8969 | 69.30490 | 20955.17 | 5157.040 | 26112.21 | 20.95517 | 0.005157040 | 20.96033 | NA | 0.2460987 | 0 | 0.0002460 | methane ref | -69.011701 | -210.4288 | 0.0001230 | -210.4288 | 0.01229606 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 7 | 855.437 | 860.662 | 889.504 | 4128.717 | 1130.0235 | 231.4799 | 68.98743 | 21029.08 | 5558.151 | 26587.23 | 21.02908 | 0.005558151 | 21.03464 | NA | 0.2643079 | 1 | 0.0002642 | methane ref | 0.000000 | -151.9000 | 0.0001321 | -151.9000 | 0.01320741 | 0.0003115 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 8 | 927.751 | 936.529 | 961.609 | 4534.019 | 1081.2981 | 230.6880 | 68.62187 | 20808.25 | 5482.657 | 26290.90 | 20.80825 | 0.005482657 | 20.81373 | NA | 0.2634848 | 0 | 0.0002631 | methane ref | -4.271874 | -155.5230 | 0.0001315 | -155.5230 | 0.01315100 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 9 | 993.377 | 1002.155 | 1023.055 | 4353.581 | 942.3458 | 232.3942 | 69.41825 | 19012.23 | 4761.478 | 23773.71 | 19.01223 | 0.004761478 | 19.01699 | NA | 0.2504429 | 0 | 0.0002498 | methane ref | -54.507987 | -198.1282 | 0.0001249 | -198.1282 | 0.01248759 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 10 | 1048.971 | 1055.032 | 1085.964 | 4070.049 | 1115.3502 | 233.3084 | 69.43352 | 20304.21 | 5382.550 | 25686.76 | 20.30421 | 0.005382550 | 20.30959 | NA | 0.2650953 | 1 | 0.0002642 | methane ref | 0.000000 | -151.9000 | 0.0001321 | -151.9000 | 0.01320741 | 0.0003115 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 11 | 1126.719 | 1135.915 | 1154.307 | 4377.211 | 967.1902 | 230.9224 | 68.91989 | 20212.07 | 5118.810 | 25330.88 | 20.21207 | 0.005118810 | 20.21719 | NA | 0.2532552 | 0 | 0.0002525 | methane ref | -44.315335 | -189.4838 | 0.0001262 | -189.4838 | 0.01262220 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 12 | 1191.927 | 1201.332 | 1223.068 | 4383.536 | 931.2333 | 232.2101 | 69.20323 | 20176.05 | 4992.138 | 25168.19 | 20.17605 | 0.004992138 | 20.18104 | NA | 0.2474289 | 0 | 0.0002467 | methane ref | -66.026049 | -207.8967 | 0.0001234 | -207.8967 | 0.01233549 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 13 | 1244.177 | 1249.402 | 1283.051 | 4160.401 | 1141.0546 | 230.8278 | 68.62405 | 20694.94 | 5481.328 | 26176.27 | 20.69494 | 0.005481328 | 20.70043 | NA | 0.2648631 | 1 | 0.0002642 | methane ref | 0.000000 | -151.9000 | 0.0001321 | -151.9000 | 0.01320741 | 0.0003115 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 14 | 1324.433 | 1333.629 | 1356.201 | 4316.019 | 980.2678 | 233.2191 | 69.48585 | 20458.90 | 5319.453 | 25778.35 | 20.45890 | 0.005319453 | 20.46422 | NA | 0.2600068 | 0 | 0.0002591 | methane ref | -19.151240 | -168.1422 | 0.0001296 | -168.1422 | 0.01295451 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 15 | 1386.297 | 1395.284 | 1416.811 | 3705.608 | 810.6083 | 220.9844 | 65.88735 | 16664.94 | 4204.549 | 20869.48 | 16.66494 | 0.004204549 | 16.66914 | NA | 0.2522992 | 0 | 0.0002513 | methane ref | -48.806364 | -193.2927 | 0.0001256 | -193.2927 | 0.01256289 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 16 | 1453.595 | 1459.447 | 1490.170 | 4182.669 | 1150.8922 | 216.9934 | 64.96403 | 22223.49 | 5898.395 | 28121.88 | 22.22349 | 0.005898395 | 22.22939 | NA | 0.2654126 | 1 | 0.0002642 | methane ref | 0.000000 | -151.9000 | 0.0001321 | -151.9000 | 0.01320741 | 0.0003115 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 17 | 1600.940 | 1608.673 | 1636.470 | 4302.989 | 1182.7732 | 229.2687 | 68.93950 | 22838.87 | 6044.344 | 28883.22 | 22.83887 | 0.006044344 | 22.84492 | NA | 0.2646516 | 0 | 0.0002634 | methane ref | -2.867311 | -154.3318 | 0.0001317 | -154.3318 | 0.01316955 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 18 | 1736.372 | 1739.716 | 1746.195 | 3973.676 | 1077.9145 | 194.8355 | 60.10338 | 18479.60 | 4857.156 | 23336.75 | 18.47960 | 0.004857156 | 18.48445 | NA | 0.2628388 | 0 | 0.0002616 | methane ref | -9.697427 | -160.1244 | 0.0001308 | -160.1244 | 0.01307935 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.cf | 19 | 1776.709 | 1779.426 | 1786.114 | 3971.912 | 1077.5780 | 194.9600 | 60.11840 | 18499.15 | 4859.828 | 23358.98 | 18.49915 | 0.004859828 | 18.50401 | NA | 0.2627055 | 0 | 0.0002615 | methane ref | -10.199640 | -160.5503 | 0.0001307 | -160.5503 | 0.01307272 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.dxf | 1 | 40.128 | 59.983 | 63.327 | NA | NA | NA | NA | NA | NA | 110929.75 | NA | NA | 57.97671 | 1 | NA | 0 | NA | N2_zero | NA | NA | NA | NA | NA | NA | 3024.040 | 2194.322 | 731.3983 | NA | NA | NA | 20.20419 | 16.66439 | 1175.724 | NA | NA | NA | 57524.32 | 41739.97 | 11665.466 | 57.52432 | 0.4173997 | 0.03499640 | 0 | 0.7256056 | 0.0073565 | 0.01600287 | 0.01600287 | 0.0036783 | 0.01600287 | 0.3664779 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.dxf | 2 | 90.915 | 110.770 | 114.114 | NA | NA | NA | NA | NA | NA | 110486.88 | NA | NA | 57.83398 | NA | NA | 1 | NA | N2_zero | NA | NA | NA | NA | NA | NA | 3022.789 | 2193.600 | 716.5056 | NA | NA | NA | 20.37561 | 16.70776 | 1229.999 | NA | NA | NA | 57383.21 | 41636.91 | 11466.758 | 57.38321 | 0.4163691 | 0.03440027 | 0 | 0.7255940 | 0.0073564 | 0.00000000 | 0.00000000 | 0.0036782 | 0.00000000 | 0.3664720 | 0.0073564 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.dxf | 3 | 125.818 | 155.287 | 216.733 | NA | NA | NA | NA | NA | NA | 98168.61 | NA | NA | 53.13610 | NA | NA | 0 | NA | N2_zero | NA | NA | NA | NA | NA | NA | 2073.872 | 1507.741 | 306.0217 | NA | NA | NA | 20.61750 | 16.67424 | 1364.278 | NA | NA | NA | 52731.67 | 38301.92 | 7135.016 | 52.73167 | 0.3830192 | 0.02140505 | 0 | 0.7263552 | 0.0073641 | 1.04910065 | 1.04910065 | 0.0036821 | 1.04910065 | 0.3668551 | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA | NA
continuous_flow_example.dxf | 4 | 274.208 | 300.124 | 365.750 | NA | NA | NA | NA | NA | NA | 240551.17 | NA | NA | 68.82495 | 1 | NA | 0 | NA | CO2_zero | NA | NA | NA | NA | NA | NA | NA | NA | NA | 2588.446 | 2969.023 | 3634.147 | NA | NA | NA | 1.290191 | 1.269749 | 1.981168 | NA | NA | NA | NA | NA | NA | 89 | NA | NA | NA | NA | NA | NA | NA | NA | 67763.92 | 77523.47 | 95263.78 | 67.76392 | 0.7752347 | 0.2857913 | 1.144023 | 1.405819 | 0.0117810 | -17.0104406 | -1.701044e+01 | 0.0040067 | -3.20667726 | -3.20667726 | 0.0109776 | -1.811690e+01 | 1.085845 | 0.0019988 | -3.16962276 | 0.1994857 | 0.0004017 | -1.6367818 | NA | NA
continuous_flow_example.dxf | 5 | 416.537 | 436.183 | 446.215 | NA | NA | NA | NA | NA | NA | 328751.58 | NA | NA | 93.43697 | NA | NA | 0 | NA | CO2_zero | NA | NA | NA | NA | NA | NA | NA | NA | NA | 4948.947 | 5759.321 | 6977.775 | NA | NA | NA | 2.972498 | 3.155700 | 4.344203 | NA | NA | NA | NA | NA | NA | 89 | NA | NA | NA | NA | NA | NA | NA | NA | 91977.27 | 107053.51 | 129720.80 | 91.97727 | 1.0705351 | 0.3891624 | 1.163913 | 1.410357 | 0.0119858 | 0.0797209 | 7.972090e-02 | 0.0040196 | 0.01142322 | 0.01142322 | 0.0111812 | 8.504090e-02 | 1.105752 | 0.0020052 | 0.01124505 | 0.2001210 | 0.0004023 | 0.0058024 | NA | NA
continuous_flow_example.dxf | 6 | 466.906 | 486.761 | 497.002 | NA | NA | NA | NA | NA | NA | 330289.66 | NA | NA | 93.87689 | NA | NA | 1 | NA | CO2_zero | NA | NA | NA | NA | NA | NA | NA | NA | NA | 4951.985 | 5762.556 | 6982.150 | NA | NA | NA | 3.138675 | 3.423053 | 4.544472 | NA | NA | NA | NA | NA | NA | 89 | NA | NA | NA | NA | NA | NA | NA | NA | 92410.41 | 107549.07 | 130330.19 | 92.41041 | 1.0754907 | 0.3909906 | 1.163820 | 1.410341 | 0.0119849 | 0.0000000 | 2.220446e-13 | 0.0040196 | 0.00000000 | 0.00000000 | 0.0111802 | 2.220446e-13 | 1.105659 | 0.0020052 | 0.00000000 | 0.2001187 | 0.0004023 | 0.0000000 | 0.0119849 | 0.0040196

    # get specific parts and add some file information
    cf_files %>%
      iso_get_vendor_data_table(
        # select peak number, ret. time, overall intensity and all H delta columns
        select = c(Nr., Rt, area = `rIntensity All`, matches("^d \\d+H")),
        # include the Analysis number fron the file info and rename it to 'run'
        include_file_info = c(run = Analysis)
      ) %>%
      knitr::kable()
    #> Info: aggregating vendor data table from 6 data file(s), including file info 'c(run = Analysis)'

file_id | run | Nr. | Rt | area | d 3H2/2H2 | d 2H/1H
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 6520 | 1 | 286.330 | 23408.20 | -160.8789 | -160.8789
continuous_flow_example.cf | 6520 | 2 | 321.233 | 23416.43 | -160.3969 | -160.3969
continuous_flow_example.cf | 6520 | 3 | 611.952 | 30831.79 | -154.2084 | -154.2084
continuous_flow_example.cf | 6520 | 4 | 671.517 | 30820.41 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 5 | 747.802 | 22771.98 | -218.1169 | -218.1169
continuous_flow_example.cf | 6520 | 6 | 809.457 | 26112.21 | -210.4288 | -210.4288
continuous_flow_example.cf | 6520 | 7 | 860.662 | 26587.23 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 8 | 936.529 | 26290.90 | -155.5230 | -155.5230
continuous_flow_example.cf | 6520 | 9 | 1002.155 | 23773.71 | -198.1282 | -198.1282
continuous_flow_example.cf | 6520 | 10 | 1055.032 | 25686.76 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 11 | 1135.915 | 25330.88 | -189.4838 | -189.4838
continuous_flow_example.cf | 6520 | 12 | 1201.332 | 25168.19 | -207.8967 | -207.8967
continuous_flow_example.cf | 6520 | 13 | 1249.402 | 26176.27 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 14 | 1333.629 | 25778.35 | -168.1422 | -168.1422
continuous_flow_example.cf | 6520 | 15 | 1395.284 | 20869.48 | -193.2927 | -193.2927
continuous_flow_example.cf | 6520 | 16 | 1459.447 | 28121.88 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 17 | 1608.673 | 28883.22 | -154.3318 | -154.3318
continuous_flow_example.cf | 6520 | 18 | 1739.716 | 23336.75 | -160.1244 | -160.1244
continuous_flow_example.cf | 6520 | 19 | 1779.426 | 23358.98 | -160.5503 | -160.5503
continuous_flow_example.dxf | 2921 | 1 | 59.983 | 110929.75 | NA | NA
continuous_flow_example.dxf | 2921 | 2 | 110.770 | 110486.88 | NA | NA
continuous_flow_example.dxf | 2921 | 3 | 155.287 | 98168.61 | NA | NA
continuous_flow_example.dxf | 2921 | 4 | 300.124 | 240551.17 | NA | NA
continuous_flow_example.dxf | 2921 | 5 | 436.183 | 328751.58 | NA | NA
continuous_flow_example.dxf | 2921 | 6 | 486.761 | 330289.66 | NA | NA

    # the data table also provides units if included in the original data file
    # which can be made explicit using the function iso_make_units_explicit()
    cf_files %>%
      iso_get_vendor_data_table(
        # select peak number, ret. time, overall intensity and all H delta columns
        select = c(Nr., Rt, area = `rIntensity All`, matches("^d \\d+H")),
        # include the Analysis number fron the file info and rename it to 'run'
        include_file_info = c(run = Analysis)
      ) %>%
      # make column units explicit
      iso_make_units_explicit() %>%
      knitr::kable()
    #> Info: aggregating vendor data table from 6 data file(s), including file info 'c(run = Analysis)'

file_id | run | Nr. | Rt [s] | area [mVs] | d 3H2/2H2 [permil] | d 2H/1H [permil]
--- | --- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 6520 | 1 | 286.330 | 23408.20 | -160.8789 | -160.8789
continuous_flow_example.cf | 6520 | 2 | 321.233 | 23416.43 | -160.3969 | -160.3969
continuous_flow_example.cf | 6520 | 3 | 611.952 | 30831.79 | -154.2084 | -154.2084
continuous_flow_example.cf | 6520 | 4 | 671.517 | 30820.41 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 5 | 747.802 | 22771.98 | -218.1169 | -218.1169
continuous_flow_example.cf | 6520 | 6 | 809.457 | 26112.21 | -210.4288 | -210.4288
continuous_flow_example.cf | 6520 | 7 | 860.662 | 26587.23 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 8 | 936.529 | 26290.90 | -155.5230 | -155.5230
continuous_flow_example.cf | 6520 | 9 | 1002.155 | 23773.71 | -198.1282 | -198.1282
continuous_flow_example.cf | 6520 | 10 | 1055.032 | 25686.76 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 11 | 1135.915 | 25330.88 | -189.4838 | -189.4838
continuous_flow_example.cf | 6520 | 12 | 1201.332 | 25168.19 | -207.8967 | -207.8967
continuous_flow_example.cf | 6520 | 13 | 1249.402 | 26176.27 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 14 | 1333.629 | 25778.35 | -168.1422 | -168.1422
continuous_flow_example.cf | 6520 | 15 | 1395.284 | 20869.48 | -193.2927 | -193.2927
continuous_flow_example.cf | 6520 | 16 | 1459.447 | 28121.88 | -151.9000 | -151.9000
continuous_flow_example.cf | 6520 | 17 | 1608.673 | 28883.22 | -154.3318 | -154.3318
continuous_flow_example.cf | 6520 | 18 | 1739.716 | 23336.75 | -160.1244 | -160.1244
continuous_flow_example.cf | 6520 | 19 | 1779.426 | 23358.98 | -160.5503 | -160.5503
continuous_flow_example.dxf | 2921 | 1 | 59.983 | 110929.75 | NA | NA
continuous_flow_example.dxf | 2921 | 2 | 110.770 | 110486.88 | NA | NA
continuous_flow_example.dxf | 2921 | 3 | 155.287 | 98168.61 | NA | NA
continuous_flow_example.dxf | 2921 | 4 | 300.124 | 240551.17 | NA | NA
continuous_flow_example.dxf | 2921 | 5 | 436.183 | 328751.58 | NA | NA
continuous_flow_example.dxf | 2921 | 6 | 486.761 | 330289.66 | NA | NA

# For expert users: retrieving all data

For users familiar with the nested data frames from the tidyverse (particularly tidyr’s `nest` and `unnest`), there is an easy way to retrieve all data from the iso file objects in a single nested data frame:

    all_data <- cf_files %>% iso_get_all_data()
    #> Info: aggregating all data from 6 data file(s)
    # not printed out because this data frame is very big

# Saving collections

Saving entire collections of isofiles for retrieval at a later point is easily done using the `iso_save` function which stores collections or individual isoreader file objects in the efficient R data storage format `.rds` (if not specified, the extension `.cf.rds` will be automatically appended). These saved collections can be conveniently read back using the same `iso_read_continuous_flow` command used for raw data files.

    # export to R data archive
    cf_files %>% iso_save("cf_files_export.cf.rds")
    #> Info: exporting data from 6 iso_files into R Data Storage 'cf_files_export.cf.rds'

    # read back the exported R data archive
    cf_files <- iso_read_continuous_flow("cf_files_export.cf.rds")
    #> Info: preparing to read 1 data files (all will be cached)...
    #> Info: reading file 'cf_files_export.cf.rds' with '.cf.rds' reader...
    #> Info: loaded 6 data files from R Data Storage
    #> Info: finished reading 1 files in 0.10 secs
    cf_files %>% iso_get_data_summary() %>% knitr::kable()
    #> Info: aggregating data summary from 6 data file(s)

file_id | raw_data | file_info | method_info | vendor_data_table | file_path
--- | --- | --- | --- | --- | ---
continuous_flow_example.cf | 8605 time points, 2 ions (2,3) | 21 entries | standards, resistors | 19 rows, 25 columns | continuous_flow_example.cf
6632_WSL-2 wood | 1952 time points, 3 ions (45,46,44) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_0b7e6b49-7756-4cca-b387-4d6617cb28e6
6605_USGS41 | 2387 time points, 2 ions (29,28) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_0e08e8b4-c625-4fd7-bf5b-9f4823f660cd
6617_IAEA600 | 1796 time points, 3 ions (45,46,44) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_1de1fdc3-0797-4e44-8357-52acbd0d4a6d
6630_GlutamicAcid04 | 2386 time points, 2 ions (29,28) | 17 entries | no method info | no vendor data table | continuous_flow_example.iarc|Task_261a3286-0bc6-4aca-bba2-183c02597d8b
continuous_flow_example.dxf | 2435 time points, 6 ions (28,29,30,44,45,46) | 21 entries | standards, resistors | 6 rows, 60 columns | continuous_flow_example.dxf

# Data Export

At the moment, isoreader supports export of all data to Excel and the Feather file format (a Python/R cross-over format). Note that both export methods have similar syntax and append the appropriate file extension for each type of export file (`.cf.xlsx` and `.cf.feather`, respectively).

    # export to excel
    cf_files %>% iso_export_to_excel("cf_files_export")
    #> Info: exporting data from 6 iso_files into Excel 'cf_files_export.cf.xlsx'
    #> Info: aggregating all data from 6 data file(s)

    # data sheets available in the exported data file:
    readxl::excel_sheets("cf_files_export.cf.xlsx")
    #> [1] "file info"         "raw data"          "standards"
    #> [4] "resistors"         "vendor data table" "problems"

    # export to feather
    cf_files %>% iso_export_to_feather("cf_files_export")
    #> Info: exporting data from 6 iso_files into .cf.feather files at 'cf_files_export'
    #> Info: aggregating all data from 6 data file(s)

    # exported feather files
    list.files(pattern = ".cf.feather")
    #> [1] "cf_files_export_file_info.cf.feather"
    #> [2] "cf_files_export_problems.cf.feather"
    #> [3] "cf_files_export_raw_data.cf.feather"
    #> [4] "cf_files_export_resistors.cf.feather"
    #> [5] "cf_files_export_standards.cf.feather"
    #> [6] "cf_files_export_vendor_data_table.cf.feather"