1. Introduction

mimsy is a package designed to calculate dissolved gas concentrations of oxygen, nitrogen, and argon from Membrane Inlet Mass Spectrometer (MIMS) signal data. For more information on the gas solubility equations used in this package, please see the References section. No R expertise is required to use mimsy, and this guide is designed for novice R users.

If you find bugs in this software, or you would like to suggest new features, please let us know on the mimsy GitHub page.

2. Installation

Install mimsy from the CRAN repository and load into your R environment:

# Install the package
install.packages("mimsy")

# Load the package
library(mimsy)

Alternatively, the latest in-development version of mimsy can be pulled from Github via:

# Install and load devtools
install.packages("devtools")
library(devtools)

install_github("michelleckelly/mimsy")

# Load the package
library(mimsy)

3. Running mimsy

The general structure for running mimsy is:

1. Format your CSV file
2. Load CSV file into R using read.csv()
3. Run the mimsy() function
4. Explore the results
5. Save the results to an Excel file using mimsy.save() or an RData file using save()

3.1. Format your CSV file

You’ll need to add some special columns to your data file before loading it into R. The easiest way to do this is to use a spreadsheet editor like Excel. We recommend saving a seperate copy of your raw data file for mimsy (add "_mimsy" to the file name) to prevent any accidents.

Click to download an example CSV file for single water bath MIMS setups (“one temperature setups”): Download data_oneTemp.csv

Click to download an example CSV file for dual water bath MIMS setups (“two temperature setups”): Download data_twoTemp.csv

CSV file format:

• You can save as CSV within Excel from the File > Save as menu, choosing the CSV (Comma delimited) (.csv) option.

Columns:

• Type
• If the row contains data for a standard, enter “Standard”. If the row contains data for a sample, enter “Sample”.
• The name of this column must be “Type” (check for correct capitalization)
• Group
• Each block of standards and the samples run directly afterwards belong to a group. You’ll enter “1” for the first block of standards and the first block of samples. You’ll enter “2” for the second block of standards and the second block of samples, etc.
• The name of this column must be “Group” (check for correct capitalization)
• CollectionTemp
• The temperature of samples or standards at the time of field collection, in degrees C
• The name of this column must be “CollectionTemp” (check for correct capitalization)
• RunDate
• The date (M/D/YYYY) that samples were run on the MIMS.
• The name of this column must be “RunDate” (check for correct capitalization)
• Label or other sample identifier columns
• mimsy will preserve all labelling columns in the final output, so you should add whatever labels or notes columns you like
• Index, Time, 28, 32, 40, N2/Ar, O2/Ar columns
• This is the default output from the MIMS. If you have a newer setup, this may also include a “99” column indicating the MIMS’ internal pressure. Including, or not including, this column won’t affect your results.

3.2. Load your CSV file into R using read.csv()

# Load data into R
data <- read.csv(file = "data_twoTemp.csv", header = TRUE, stringsAsFactors = FALSE)

# Check it out
data
Type Group CollectionTemp RunDate Label Index Time X28 X32 X40 N2.Ar O2.Ar Notes
Standard 1 24.9 2/1/18 NA 3029 10:32:53 AM 0 0 0 40.27659 19.29615 Barometric pressure = 977.2 hPa
Standard 1 24.9 2/1/18 NA 3079 10:34:07 AM 0 0 0 40.28539 19.29992
Standard 1 24.9 2/1/18 NA 3128 10:35:19 AM 0 0 0 40.29580 19.30377
Standard 1 26.3 2/1/18 NA 3212 10:37:22 AM 0 0 0 40.42873 19.31060
Standard 1 26.3 2/1/18 NA 3261 10:38:35 AM 0 0 0 40.41858 19.30813
Standard 1 26.3 2/1/18 NA 3315 10:39:54 AM 0 0 0 40.43270 19.30843
Sample 1 25.1 2/1/18 Sample1 3455 10:43:20 AM 0 0 0 40.46266 22.82152
Sample 1 25.1 2/1/18 Sample2 3554 10:45:46 AM 0 0 0 40.47978 22.88816
Sample 1 25.1 2/1/18 Sample3 3620 10:47:23 AM 0 0 0 40.47607 22.91647
Sample 1 26.1 2/1/18 Sample4 3701 10:49:22 AM 0 0 0 39.79033 22.77329
Sample 1 26.1 2/1/18 Sample5 3792 10:51:36 AM 0 0 0 39.87121 22.93365
Sample 1 26.1 2/1/18 Sample6 3913 10:54:34 AM 0 0 0 40.33485 22.85876
Sample 1 25.3 2/1/18 Sample7 3975 10:56:05 AM 0 0 0 40.44159 22.58631
Sample 1 25.3 2/1/18 Sample8 4043 10:57:45 AM 0 0 0 40.40981 22.88878
Sample 1 25.3 2/1/18 Sample9 4121 10:59:40 AM 0 0 0 40.28400 23.18026
Sample 1 24.9 2/1/18 Sample10 4233 11:02:25 AM 0 0 0 40.86557 19.27496
Sample 1 24.9 2/1/18 Sample11 4327 11:04:43 AM 0 0 0 40.90063 19.20336
Sample 1 24.9 2/1/18 Sample12 4422 11:07:03 AM 0 0 0 40.87803 19.17829
Standard 2 24.9 2/1/18 NA 4654 11:12:45 AM 0 0 0 40.38071 19.34272
Standard 2 24.9 2/1/18 NA 4742 11:14:54 AM 0 0 0 40.37351 19.34234
Standard 2 24.9 2/1/18 NA 4779 11:15:48 AM 0 0 0 40.38127 19.34579
Standard 2 26.3 2/1/18 NA 4866 11:17:57 AM 0 0 0 40.48250 19.34875
Standard 2 26.3 2/1/18 NA 4962 11:20:18 AM 0 0 0 40.48784 19.34937
Standard 2 26.3 2/1/18 NA 5007 11:21:24 AM 0 0 0 40.48557 19.34862
Sample 2 26.3 2/1/18 Sample13 4516 11:09:21 AM 0 0 0 40.80347 19.00344
Sample 2 26.3 2/1/18 Sample14 5089 11:23:25 AM 0 0 0 40.85389 19.24914
Sample 2 26.3 2/1/18 Sample15 5179 11:25:37 AM 0 0 0 40.82519 19.28765
Sample 2 25.7 2/1/18 Sample16 5270 11:27:51 AM 0 0 0 40.87712 18.98291
Sample 2 25.7 2/1/18 Sample17 5370 11:30:18 AM 0 0 0 40.82986 19.20466
Sample 2 25.7 2/1/18 Sample18 5475 11:32:53 AM 0 0 0 40.82610 19.27355
Sample 2 25.9 2/1/18 Sample19 5668 11:37:37 AM 0 0 0 40.29644 25.40370
Sample 2 25.9 2/1/18 Sample20 5741 11:39:24 AM 0 0 0 40.24260 25.56124
Sample 2 25.9 2/1/18 Sample21 5972 11:45:04 AM 0 0 0 40.36147 25.51976
Sample 2 25.2 2/1/18 Sample22 6079 11:47:42 AM 0 0 0 40.03570 26.81639
Sample 2 25.2 2/1/18 Sample23 6192 11:50:28 AM 0 0 0 40.15149 26.95080
Sample 2 25.2 2/1/18 Sample24 6335 11:53:58 AM 0 0 0 39.77960 27.15118
Standard 3 24.9 2/1/18 NA 6475 11:57:24 AM 0 0 0 40.46484 19.63069
Standard 3 24.9 2/1/18 NA 6542 11:59:03 AM 0 0 0 40.46932 19.53179
Standard 3 24.9 2/1/18 NA 6599 12:00:27 PM 0 0 0 40.49352 19.50314
Standard 3 26.3 2/1/18 NA 6723 12:03:29 PM 0 0 0 40.55150 19.45527
Standard 3 26.3 2/1/18 NA 6825 12:05:59 PM 0 0 0 40.54939 19.42995
Standard 3 26.3 2/1/18 NA 6870 12:07:06 PM 0 0 0 40.55973 19.42807

Don’t be worried that your “28”, “32”, and “40” columns are now “X28”, “X32”, and “X40”. As R doesn’t accept column names that start with a number, it added an “X” to these column names when the data was imported. Similarly, “N2/Ar” and “O2/Ar” have been automatically adjusted to “N2.Ar” and “O2.Ar”.

3.3. Run the mimsy() function

You must specify the barometric pressure (as baromet.press) and its units in the function argument. Units must be one of "atm", "hPa", "psi", "bar", or "Torr". All other inputs, such as background corrections or standard salinity, are optional. Check out ?mimsy for more information.

# Run the function
results <- mimsy(data, baromet.press = 977.2, units = "hPa")
#> Calculated dissolved concentrations based on a two-point temperature standard.
#> Standard 1: 24.9 C, Standard 2: 26.3 C

3.4. Explore the results

You’ll see that mimsy() returns a list containing five seperate dataframes (results, solubility.Concentrations, calibration.Factors, calibration.DriftCorrection, and results.full). Check out ?mimsy() for more specific information on those outputs and how they were calculated.

# Check out the summarized results
results$results The summarized results includes the calculated gas concentrations for all samples: CollectionTemp Label Notes arSat.conc_uMol.kg Ar_uMol N2Ar O2Ar N2_uMol O2_uMol O2.BubbleCorrected_uMol N2_mg O2_mg O2.BubbleCorrected_mg Ar_mg 25.1 Sample1 12.09965 11.58375 39.04704 25.01304 472.4557 302.6491 315.5533 13.22876 9.684772 10.097706 0.4633502 25.1 Sample2 12.09965 11.55084 39.05838 25.08267 472.5929 303.4915 317.2572 13.23260 9.711729 10.152230 0.4620337 25.1 Sample3 12.09965 11.51571 39.05136 25.11142 472.5079 303.8394 318.5030 13.23022 9.722862 10.192094 0.4606286 26.1 Sample4 11.88145 11.17233 38.37769 25.09848 455.9827 298.2064 316.0043 12.76751 9.542604 10.112136 0.4468932 26.1 Sample5 11.88145 11.18067 38.45231 25.27225 456.8693 300.2711 317.9814 12.79234 9.608674 10.175403 0.4472269 26.1 Sample6 11.88145 11.34883 38.89491 25.18581 462.1280 299.2440 312.6585 12.93958 9.575807 10.005072 0.4539532 25.3 Sample7 12.05545 11.32820 38.99877 24.76680 470.1476 298.5748 316.5864 13.16413 9.554393 10.130765 0.4531279 25.3 Sample8 12.05545 11.41191 38.96478 25.09616 469.7378 302.5454 318.6957 13.15266 9.681451 10.198261 0.4564764 25.3 Sample9 12.05545 11.37789 38.83963 25.41305 468.2291 306.3657 323.5845 13.11041 9.803702 10.354705 0.4551155 24.9 Sample10 12.14415 11.40900 39.39490 21.07834 478.4175 255.9785 271.4742 13.39569 8.191311 8.687174 0.4563599 24.9 Sample11 12.14415 11.45413 39.42348 20.99730 478.7645 254.9943 269.4829 13.40541 8.159818 8.623451 0.4581651 24.9 Sample12 12.14415 11.49938 39.39640 20.96711 478.4356 254.6277 268.1467 13.39620 8.148087 8.580694 0.4599751 26.3 Sample13 11.83865 11.36148 39.32482 20.95014 465.5527 248.0213 258.0180 13.03548 7.936681 8.256576 0.4544592 26.3 Sample14 11.83865 11.47147 39.35255 21.19046 465.8809 250.8664 258.6470 13.04467 8.027724 8.276704 0.4588589 26.3 Sample15 11.83865 11.47633 39.32164 21.22807 465.5150 251.3116 259.0028 13.03442 8.041970 8.288089 0.4590534 25.7 Sample16 11.96789 11.42968 39.36071 20.79488 471.0646 248.8709 260.0629 13.18981 7.963867 8.322013 0.4571871 25.7 Sample17 11.96789 11.43503 39.31090 21.02942 470.4685 251.6778 262.8836 13.17312 8.053691 8.412274 0.4574012 25.7 Sample18 11.96789 11.44067 39.30274 21.09600 470.3709 252.4746 263.5967 13.17039 8.079187 8.435096 0.4576269 25.9 Sample19 11.92453 11.40212 38.78803 27.83127 462.5291 331.8749 346.4143 12.95082 10.619997 11.085256 0.4560849 25.9 Sample20 11.92453 11.40601 38.73328 27.99674 461.8763 333.8481 348.3650 12.93254 10.683138 11.147681 0.4562404 25.9 Sample21 11.92453 11.41837 38.83837 27.92871 463.1294 333.0369 347.1735 12.96762 10.657180 11.109551 0.4567346 25.2 Sample22 12.07751 11.29627 38.50567 29.14297 465.0527 351.9746 374.7423 13.02148 11.263187 11.991754 0.4518508 25.2 Sample23 12.07751 11.34212 38.61164 29.27172 466.3326 353.5296 375.0558 13.05731 11.312947 12.001784 0.4536849 25.2 Sample24 12.07751 11.18978 38.24725 29.46728 461.9316 355.8915 382.0507 12.93409 11.388528 12.225623 0.4475911 # Check out the solubility concentrations results$solubility.Concentrations
O2.conc_uMol.kg N2.conc_uMol.kg Ar.conc_uMol.kg
24.9 deg C 256.7397 472.4339 12.14415
26.3 deg C 252.4423 461.8634 11.83865

Check out ?mimsy() for more specific information on the results, solubility.Concentrations, calibration.Factors, calibration.DriftCorrection, and results.full dataframes, including details on how they were calculated.

3.5. Save the results

# Save output to an Excel workbook
mimsy.save(results, file = "results.xlsx")

# Save output to an RData file
save(results, file = "results.RData")

We don’t reccomend saving results dataframes to CSV files (although it is possible), as you’ll need multiple CSV’s to preserve all of the outputs, and that gets kind of messy. A good alternative is to save both an Excel workbook copy and an RData copy, that way all of your output is preserved every time.

You can load RData files back into R using load("results.RData"). Check out ?load() for more info.

4. Putting it all together

# Install mimsy
install.packages("mimsy")

# Done! :)