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")
## Reading file /Library/Frameworks/R.framework/Versions/3.2/Resources/library/isoread/extdata/dual_inlet_example.did

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())
analysis cycle mass28 mass29 mass32 mass33 mass34 mass38 mass40 mass44
Standard 1 2314.045 5754.992 427.1106 42.80679 593.5613 106.9198 4462.168 2578.955
Standard 2 2314.073 5752.840 427.1716 42.77963 593.6251 107.0572 4461.578 2618.840
Standard 3 2308.652 5740.336 426.2080 42.69747 592.3305 106.7632 4451.030 2631.241
Standard 4 2306.104 5735.285 425.7591 42.65157 591.6958 106.5660 4446.119 2639.536
Standard 5 2302.021 5724.794 425.0106 42.56889 590.5780 106.4758 4438.080 2640.291
Standard 6 2308.069 5739.984 426.1472 42.70022 592.1224 106.7954 4449.582 2651.911
Standard 7 2308.090 5739.708 426.1624 42.69850 592.1496 106.8122 4449.758 2655.171
Standard 8 2308.144 5739.896 426.1803 42.70228 592.2626 106.8325 4449.918 2658.405
Standard 9 2305.838 5734.350 425.7644 42.66567 591.6759 106.8660 4445.576 2658.389
Standard 10 2306.315 5735.724 425.8567 42.66567 591.7188 106.7118 4446.588 2660.560
Standard 11 2307.218 5737.932 426.0261 42.68440 592.0723 106.8456 4448.227 2662.468
Standard 12 2308.210 5740.555 426.2206 42.69283 592.3284 106.8522 4450.332 2664.312
Standard 13 2303.953 5729.707 425.4309 42.63369 591.1562 106.6712 4441.975 2661.175
Standard 14 2305.753 5734.431 425.7635 42.65260 591.6582 106.5983 4445.466 2662.850
Standard 15 2306.300 5735.799 425.8665 42.67357 591.8391 106.8433 4446.617 2664.359
Sample 1 2301.973 5724.794 424.8054 42.56047 590.4190 106.4125 4439.297 2526.243
Sample 2 2298.603 5716.512 424.2802 42.50254 589.6891 106.2093 4431.861 2591.896
Sample 3 2294.369 5703.757 423.5372 42.43292 588.5650 106.1346 4423.353 2613.448
Sample 4 2292.602 5701.618 423.2413 42.39906 588.2251 106.1388 4420.078 2625.208
Sample 5 2289.086 5692.840 422.6165 42.33993 587.2422 105.9075 4413.272 2629.914
Sample 6 2288.389 5691.215 422.4965 42.33408 587.1575 106.0384 4411.821 2633.810
Sample 7 2292.898 5702.283 423.3390 42.41419 588.3569 106.2021 4420.228 2642.814
Sample 8 2295.388 5708.688 423.8095 42.45699 588.9352 106.3133 4425.160 2648.109
Sample 9 2292.384 5701.034 423.2620 42.40164 588.1781 106.1250 4419.340 2647.268
Sample 10 2292.080 5700.124 423.2144 42.43034 588.1980 106.1328 4418.956 2649.154
Sample 11 2291.922 5700.017 423.1893 42.39218 588.0809 106.2410 4418.806 2649.913
Sample 12 2290.592 5696.548 422.9509 42.37912 587.7399 106.0916 4416.191 2649.625
Sample 13 2292.622 5701.611 423.3327 42.39855 588.3370 106.2643 4420.198 2653.452
Sample 14 2292.715 5701.894 423.3452 42.41316 588.3831 106.1967 4420.379 2653.427
Sample 15 2287.184 5688.116 422.3200 42.28922 586.8710 105.8699 4409.457 2647.124
Standard 0 2319.591 5768.939 427.8949 42.86850 594.7283 106.1920 4474.801 2419.137

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())
cycle d 32O2/28N2 d 32O2/29N2 d 40Ar/28N2 d 32O2/40Ar d 44CO2/28N2 d 44CO2/40Ar
1 0.0980921 0.1421863 -0.1250340 0.2230465 17.361331 17.481194
2 -0.0190026 -0.1986415 -0.0477705 0.0287593 4.011599 4.059004
3 -0.0368937 0.0652816 -0.0425848 0.0056908 2.953237 2.995911
4 -0.0340016 -0.1304614 -0.0021110 -0.0318906 2.556024 2.558140
5 -0.0078191 -0.0158211 0.0104945 -0.0183139 2.728998 2.718456
6 -0.0168540 -0.0604423 0.0228565 -0.0397103 2.601003 2.578072
7 -0.0301186 -0.0634252 -0.0394053 0.0092870 2.551532 2.591048
8 -0.0272254 -0.1218628 -0.0311020 0.0038767 2.260614 2.291790
9 -0.0310329 -0.0727141 -0.0551547 0.0241232 2.158959 2.214241
10 -0.0274719 -0.0092828 -0.0317104 0.0042385 2.202047 2.233831
11 -0.0259919 -0.0447872 0.0042289 -0.0302208 2.090056 2.085817
12 -0.0254705 -0.0056133 -0.0173751 -0.0080958 2.268057 2.285474
13 -0.0182514 -0.0099826 -0.0010664 -0.0171851 2.360382 2.361445
14 -0.0252622 -0.0271131 0.0135928 -0.0388544 2.051568 2.037947
15 -0.0372995 -0.0128886 -0.0581892 0.0208909 1.999905 2.058216

Summary

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

kable(file$get_data_table(summarize = TRUE))
Variable Mean Std. Devi. Std. Error.
d 32O2/28N2 -0.0176402 0.0329837 0.0085163
d 32O2/29N2 -0.0377045 0.0805434 0.0207962
d 40Ar/28N2 -0.0266887 0.0379295 0.0097934
d 32O2/40Ar 0.0090428 0.0633772 0.0163639
d 44CO2/28N2 3.4770208 3.8734844 1.0001294
d 44CO2/40Ar 3.5033723 3.8997987 1.0069237

Or to display only a few of these

kable(file$get_data_table(select = c("d 32O2/28N2", "d 44CO2/40Ar"), sum = T))
Variable Mean Std. Devi. Std. Error.
d 32O2/28N2 -0.0176402 0.0329837 0.0085163
d 44CO2/40Ar 3.5033723 3.8997987 1.0069237

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())
Property Value
File location /Library/Frameworks/R.framework/Versions/3.2/Resources/library/isoread/extdata/dual_inlet_example.did
Date 2016-05-30 21:16:05
Info_Peak Peak Center found at [58910]
Info_Background Background: 1.75 mV,4.88 mV,2.34 mV,-2.04 mV,2.61 mV,22.83 mV,2.93 mV,242.96 mV (Bender-Lab-User)
Row 1
Peak Center 1
Background 1
Pressadjust 0
Identifier 1 Stability
Identifier 2 ON
Analysis 1481
Comment Test System
Preparation
Method dual inlet Paul.met

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")
## Creating raw export for dual_inlet_example.did ...
## raw data exported to my_file_raw.csv
file$export_data(file = "my_file_table.csv", type = "table")
## Creating table export for dual_inlet_example.did ...
## table data exported to my_file_table.csv
file$export_data(file = "my_file_summary.csv", type = "summary")
## Creating summary export for dual_inlet_example.did ...
## summary data exported to my_file_summary.csv
file$export_data(file = "my_file_info.csv", type = "info")
## Creating info export for dual_inlet_example.did ...
## info data exported to my_file_info.csv

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")
## Reading file /Library/Frameworks/R.framework/Versions/3.2/Resources/library/isoread/extdata/dual_inlet_clumped_carbonate.did

Raw data

library(knitr)
kable(file$get_mass_data())
analysis cycle mass44 mass45 mass46 mass47 mass48 mass49
Standard 1 15941.14 18995.66 21954.19 2512.345 29.80048 -180.9752
Standard 2 15933.54 18986.64 21943.58 2511.280 29.81818 -180.7748
Standard 3 15916.58 18966.34 21919.97 2508.497 29.78074 -180.4583
Standard 4 15901.62 18948.60 21899.17 2506.104 29.76304 -180.2311
Standard 5 15896.00 18941.97 21891.49 2505.600 29.75818 -180.3095
Standard 6 15884.63 18928.51 21876.19 2503.555 29.72923 -180.2013
Standard 7 15875.89 18918.12 21863.96 2502.444 29.69513 -180.0340
Sample 1 15955.18 19122.71 22237.99 2559.245 31.09436 -181.2460
Sample 2 15945.64 19111.16 22224.65 2557.857 31.09153 -180.9976
Sample 3 15925.90 19087.57 22197.05 2554.388 31.06846 -180.7002
Sample 4 15911.10 19069.70 22176.18 2552.023 31.01948 -180.4653
Sample 5 15909.83 19068.24 22174.62 2551.665 31.02819 -180.2734
Sample 6 15912.56 19071.57 22178.48 2552.281 31.04205 -180.5112
Sample 7 15914.03 19073.47 22180.52 2552.800 31.05845 -180.3734
Standard 0 15946.42 19001.94 21960.62 2513.280 29.78742 -181.2712
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())
cycle d 45CO2/44CO2 d 46CO2/44CO2 d13C d18O d17O at% 13C at% 18O
1 3.328777 37.33065 2.192992 37.36646 6.202321 1.108056 0.2075809
2 3.320955 37.31180 2.185295 37.34760 6.192886 1.108048 0.2075772
3 3.326338 37.31751 2.190857 37.35331 6.195743 1.108054 0.2075783
4 3.320030 37.31721 2.184106 37.35302 6.195597 1.108047 0.2075782
5 3.318741 37.32977 2.182264 37.36560 6.201893 1.108045 0.2075808
6 3.317755 37.32285 2.181460 37.35868 6.198427 1.108044 0.2075794
7 3.321752 37.31837 2.185909 37.35418 6.196176 1.108049 0.2075785

Summary

kable(file$get_data_table(summarize = TRUE))
Variable Mean Std. Devi. Std. Error.
d 45CO2/44CO2 3.322050 0.0040499 0.0015307
d 46CO2/44CO2 37.321165 0.0069678 0.0026336
d13C 2.186126 0.0043016 0.0016259
d18O 37.356979 0.0069742 0.0026360
d17O 6.197578 0.0034906 0.0013193
at% 13C 1.108049 0.0000047 0.0000018
at% 18O 0.207579 0.0000014 0.0000005

Or only a few of these

kable(file$get_data_table(select = c("d13C", "d18O"), sum = T))
Variable Mean Std. Devi. Std. Error.
d13C 2.186126 0.0043016 0.0016259
d18O 37.356979 0.0069742 0.0026360

Other info

And whatever other information was pulled out of the file.

kable(file$get_info())
Property Value
File location /Library/Frameworks/R.framework/Versions/3.2/Resources/library/isoread/extdata/dual_inlet_clumped_carbonate.did
Date 2016-05-30 21:16:05
Info_Peak Peak Center found at [61032]
Info_Background Background: 8.87 mV,11.31 mV,12.98 mV,6.40 mV,1.90 mV,5.88 mV (old253)
Info_PressAdjust PressAdjust: L: 15972.5 R: 15971.6 ( Manual Adjustment )
Line 158
Peak Center 1
Pressadjust 1
Background 1
Identifier 1 CIT Carrara
Identifier 2 13
Analysis 49077
Comment
Preparation
Post Script
Method CO2_multiply_16V.met