Learn R Programming

isoreader

About

This package is intended as a unified one-stop command line interface to all common IRMS (isotope ratio mass spectrometry) file formats used in stable isotope geochemistry. It is an extension and highly stream-lined re-implementation of the proof-of-concept isoread package and is designed to fit into a larger framework of IRMS data tools that includes the web-based graphical user interface package isoviewer and the data processing and visualization pipeline isoprocessor.

isoreader enables the reading and processing of stable isotope data directly from the data files and thus provides a tool for platform-independent (Windows, Mac, Linux), efficient and reproducible data reduction. Although implemented in R, it can be used in both RMarkdown as well as Jupyter data processing notebooks and also provides functionality for easy export to Python using the shared R/Python feather file format. At present, it can read most Thermo dual inlet (.did, .caf) and continuous flow (.dxf, .cf) data files as well as Elementar continuous flow data archives (.iarc) with additional extensions for other file formats in the works. Due to the dynamic implementation and design based on the popular tidyverse style of R programming, isoreader is easily extendable, takes care of error catching to avoid pipeline breaks due to problems encountered in source data files (modeled after readr) and works great with tidyverse packages such as tidyr, dplyr and ggplot.

Installation

You can install the latest release of isoreader from CRAN:

install.packages("isoreader")

Some isoreader features including Excel and feather export depend on optional packages that are not required for the core functionality of isoreader. To use this functionality, please install the following packages manually if not already installed (isoreader will throw an informative warning if they are needed but missing):

# optional extensions
install.packages(c("feather", "openxlsx", "xml2", "BiocManager"))
BiocManager::install("rhdf5")

To install the current development version of isoreader directly from GitHub, please use the devtools package:

# installs the development tools package if not yet installed
if(!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")
devtools::install_github("isoverse/isoreader")

Troubleshooting note: depending on your workspace and operating system, you may have to re-start your R session or manually install some dependencies. For example, the digest package sometimes causes trouble

  • re-install with

remove.packages("digest"); install.packages("digest").

Show me some code

You can, for example, automatically read the data from all supported scan files in a directory (and all its subdirectories) simply by providing the path to the folder. The following code demonstrates this with the example data files bundled with the isoreader package. For a more detailed example including continuous flow and dual inlet file reads, check out our Quick Start Vignette.

library(isoreader)
data_folder <- iso_get_reader_examples_folder()
iso_files <- iso_read_scan(data_folder)
#> Info: preparing to read 4 data files...
#> Info: reading file 'background_scan_example.scn' with '.scn' reader...
#> Info: reading file 'full_scan_example.scn' with '.scn' reader...
#> Info: reading file 'peak_shape_scan_example.scn' with '.scn' reader...
#> Info: reading file 'time_scan_example.scn' with '.scn' reader...
#> Info: finished reading 4 files in 0.82 secs

iso_files
#> Data from 4 scan iso files: 
#> # A tibble: 4 × 5
#>   file_id                     raw_data        file_info method_info file_path   
#>   <chr>                       <glue>          <chr>     <chr>       <chr>       
#> 1 background_scan_example.scn 525 measuremen… 8 entries resistors   background_…
#> 2 full_scan_example.scn       799 measuremen… 8 entries resistors   full_scan_e…
#> 3 peak_shape_scan_example.scn 220 measuremen… 8 entries resistors   peak_shape_…
#> 4 time_scan_example.scn       5532 measureme… 8 entries resistors   time_scan_e…

Supported File Types

Currently supported file types:

typeextensionsoftwaredescription
continuous flow.cfIsodatContinuous Flow file format (older)
continuous flow.cf.rdsisoreaderR Data Storage
continuous flow.dxfIsodatContinuous Flow file format (newer)
continuous flow.iarcionOSContinuous Flow data archive
dual inlet.cafIsodatDual Inlet file format (older)
dual inlet.di.rdsisoreaderR Data Storage
dual inlet.didIsodatDual Inlet file format (newer)
dual inlet.txtNuDual Inlet file format
scan.scan.rdsisoreaderR Data Storage
scan.scnIsodatScan file format

Documentation

  • for a quick introduction, check out the aforementioned Quick Start Vignette
  • for a full reference of all available functions, see the Function Reference
  • for function help within RStudio, simply start typing ?iso_ in the console and a list of available function will appear (all functions share the iso_ prefix)
  • for a detailed example of how to work with continuous flow data files, see the vignette on Continuous Flow
  • for a detailed example of how to work with dual inlet data files, see the vignette on Dual Inlet
  • for a detailed example of how to work with scan data files, see the vignette on Scans

Troubleshooting

If you run into a file format that is not currently supported or any issues with supported formats, please file a request/bug report in the issue tracker. Likewise if you run into any unexpected behavior or uncaught errors. Most isoreader functionality is continuously tested on Unix and Windows systems using GitHub Actions. This makes it possible to ensure proper functionality and catch issues quickly, however, sometimes something slips through or is not yet automatically tested. We try to make sure to fix such errors as soon as possible but ask for patience due to the small development team. If you have the skills and are willing to fix problems yourself, that’s great, please take a look at the development section below.

Development

If you are interested in helping with development, that’s fantastic! Please fork the repository and branch off from the dev branch since it contains the most up-to-date development version of isoreader. Make sure to write testthat tests for your work (stored in the tests/testthat directory). All tests can be run automatically and continuously during development to make it easier to spot any code problems on the go. The easiest way to run them is by running make auto_test in the isoreader directory from command line (it will test everything automatically in a completely separate R session).

Open Source

isoreader is and will always be fully open-source (i.e. free as in freedom and free as in free beer) and is provided as is. The source code is released under GPL-2.

isoverse

This package is part of the isoverse suite of data tools for stable isotopes. If you like the functionality that isoverse packages provide to the geochemical community, please help us spread the word and include an isoverse or individual package logo on one of your posters or slides. All logos are posted in high resolution in this repository.

Copy Link

Version

Install

install.packages('isoreader')

Monthly Downloads

21

Version

1.3.2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Sebastian Kopf

Last Published

November 18th, 2021

Functions in isoreader (1.3.2)

extract_data

Overview of text data extraction functions
iso_convert_signals

moved to isoprocessor
iso_add_file_info.iso_file_list

Add additional file information
extract_word

Extract words from text
iso_get_vendor_data_table

Aggregate vendor computed table data
iso_register_dual_inlet_file_reader

Register file readers
iso_export_to_feather

Export to feather
iso_filter_files

Filter iso_files
iso_convert_time

moved to isoprocessor
iso_get_problems_summary

Retrieve a summary of the problems
iso_caching

Turn caching on/off
extract_substring

Extract a substring from text
iso_is_file

Isoreader data structure functions
iso_get_problems

Retrieve parsing problems
iso_get_file_info

Aggregate file info
iso_mutate_file_info

Mutate file info
iso_filter_files_with_problems

Filter out problematic files
iso_get_units

Retrieve number units
iso_debug_mode

Debugging functions
iso_get_supported_file_types

Supported file types
iso_with_units

Generate values with units
iso_calculate_ratios

moved to isoprocessor
iso_cleanup_reader_cache

Cleanup cached files
iso_parse_file_info

Parse file info
iso_read_scan

Load scan data
iso_is_double_with_units

Check if a value has units
iso_get_raw_data

Aggregate raw data
iso_get_standards_info

DEPRECATED
set_temp

Set temporary option
iso_plot_raw_data

moved to isoprocessor
iso_format

Format values
iso_make_units_implicit

Make units implicit
iso_omit_files_with_problems

Renamed to iso_filter_files_with_problems
iso_get_all_data

Aggregate all isofiles data
print.iso_file_list

Isofile printing
iso_root_paths

Root paths
isoread

Read isotope data file
iso_rename_file_info

Rename file info columns
iso_expand_paths

Expand file paths
vec_arith.iso_double_with_units

vec_arith for iso_double_with_units
iso_export_to_excel

Export data to Excel
iso_get_resistors_info

DEPRECATED
iso_get_default_reader_parameters

Get the current default parameters
iso_get_bgrd_data

Aggregate background data
iso_get_data

DEPRECATED
iso_get_data_summary

Get data summary
iso_make_units_explicit

Make units explicit
iso_set_default_read_parameters

Set default read options
iso_reread_files

Re-read iso_files
print.binary_structure_map

Print binary structure map
iso_find_absolute_path_roots

Find roots for absolute paths
iso_has_problems

Check for parsing problems
reexports

Objects exported from other packages
iso_get_resistors

Aggregate resistors from methods info
iso_get_reader_example

Example files
iso_read_continuous_flow

Load continuous flow data
iso_info_messages

Control information messages
read_iso_file

Read individual iso file
iso_set_file_root

Set iso file directory root
isoreader-package

isoreader: Read Stable Isotope Data Files
map_binary_structure

Map isodat file binary structure.
iso_read_dual_inlet

Load dual inlet data
iso_plot_dual_inlet_data

moved to isoprocessor
iso_get_standards

Aggregate standards from methods info
iso_plot_continuous_flow_data

moved to isoprocessor
iso_strip_units

Strip units from variables
iso_problem_functions

Problem Functions Overview
iso_select_file_info

Select file info columns
iso_read_files

Core function to read isotope data files
iso_save

Save data to R Data Storage (.rds)
reread_iso_files

Re-read iso_files
vec_cast.iso_double_with_units

vec_cast for iso_double_with_units
vec_ptype2.iso_double_with_units

vec_ptype2 for iso_double_with_units
iso_shorten_relative_paths

Shorten relative paths