Here, we read two simple dual inlet isodat files that are provided as examples in the module. isoread takes all the information directly from the binary, which makes it easy to record each step of what is happening with the data.

Installation (not run)

install.packages('devtools', depen=T) 
library(devtools)
install_github('sebkopf/isotopia')
install_github('sebkopf/isoread')

Dual inlet example 1

We start by loading the example dual inlet file (type = "DI") stored in the isoread package using the isoread command.

library(isoread)
path <- system.file(package="isoread", "extdata", "dual_inlet_example.did")
file <- isoread(path, type = "DI")

The file variable now contains an isoread object with all the information that was extracted from the binary file and we can take a look at the data it holds.

Raw data

The raw voltages provide information on the signal stability between the sample and standard for all recorded masses. Here, we are using the k-table or kable command from the knitr package for lightly formatted table output. Instead, we can also just retrieve the raw mass data as a data frame using the get_mass_data() method, which, if needed, can be easily exported to a csv file (described in more details later).

library(knitr)
kable(file$get_mass_data())

Visualization

For convenience, isoread also implements several plotting functions so we can quickly visualize the raw data. The make_ggplot() method generates a ggplot2 plot object which can be printed (or saved as a PDF) as is, or modified using all functionality provided by the ggplot2 - here for example, with the addition of a figure caption.

file$make_ggplot() + labs(title = "Raw mass voltages plot")
ggsave("my_file.pdf", width = 10, height = 7)

Or only a few masses

The make_ggplot() method can take additional parameters to plot only specific masses of interest.

file$make_ggplot(masses = c("mass32", "mass34"))

Processed data

Whole table

In theory, the data reduction could be performed ab initio from the raw voltage counts, but in practice it is often easier to start with the precomputed processed data from Isodat and pipe those information to the standard data processing procedure that comes traditionally after this step. That's why isoread attempts to read the whole data table from the binary file as well, although this is the step that often requires some fine tuning to make sure the processor really captures all relevant data columns in the right format (see clumped CO2 isodat file example below).

kable(file$get_data_table())

Summary

Or to summarize the information quickly, use the parameter summarize = TRUE.

kable(file$get_data_table(summarize = TRUE))

Or to display only a few of these

kable(file$get_data_table(select = c("d 32O2/28N2", "d 44CO2/40Ar"), sum = T))

File information

Since isoread has access to the original raw binary data file, it can extract other parameters stored with the data. These are the ones currently retrieved for dual inlet files:

kable(file$get_info())

Data export

Lastly, isoread provides a convenience method (export_data()) to export all of these data to comma-separated-value (csv) files.

file$export_data(file = "my_file_raw.csv", type = "raw")
file$export_data(file = "my_file_table.csv", type = "table")
file$export_data(file = "my_file_summary.csv", type = "summary")
file$export_data(file = "my_file_info.csv", type = "info")

Extensions

For reading entire folders of isodat files, you can use the isoread_folder function which returns a vector of all contained isodat files as isoread objects. This whole group of files can be e.g. exported at once using the export_data function. For additional information on functionality provided by the isoread package, please pull up the package help via help(package="isoread").

For all bug reports and feature requests, please use the Issue Tracker on the project's GitHub page.

Example 2: Clumped carbonate isotope data

The second example is a slightly more specialized dual inlet analysis for clumped CO2 measurements. Here, the specialized implementation of the "CO2_CLUMPED" data type ensures direct acess to all the relevant data summary values in addition to the raw voltage readings of the dual inlet data.

library(isoread)
file <- isoread(system.file("extdata", "dual_inlet_clumped_carbonate.did", package="isoread"), type = "CO2_CLUMPED")

Raw data

library(knitr)
kable(file$get_mass_data())
file$make_ggplot()

Or only a few masses

file$make_ggplot(masses = c("mass44", "mass47"))

Processed data

Whole table

The entire table of processed data.

kable(file$get_data_table())

Summary

kable(file$get_data_table(summarize = TRUE))

Or only a few of these

kable(file$get_data_table(select = c("d13C", "d18O"), sum = T))

Other info

And whatever other information was pulled out of the file.

kable(file$get_info())


sebkopf/isoread documentation built on Dec. 31, 2021, 4:15 a.m.