Learn R Programming

scuba (version 1.1-5)

scuba: The Scuba Package

Description

This is a summary of the features of scuba, a package in R that performs theoretical calculations about scuba diving --- dive profiles, decompression models, gas toxicity and so on.

Arguments

Introductory Tutorial

A dive profile (depth/time profile) is created with the command dive. For example, the command d <- dive(c(18, 45)) specifies a dive to 18 metres for 45 minutes. The command d <- dive(c(18, 45), c(5,3)) specifies a dive to 18 metres for 45 minutes followed by a safety stop at 5 metres for 3 minutes. Multilevel dives with any number of stages are specified in the same way.

The resulting object d is an object of class "dive". It can be plotted as a conventional dive profile by typing plot(d) as explained in the help entry for plot.dive. It can be printed as a table of depths and times by typing its name d, or by typing print(d,seconds=FALSE) to print times to the nearest minute, as explained in the help entry for print.dive. A summary of the dive (with such information as the average depth, maximum depth and the main stages of the dive) can be printed by typing summary(d).

By default, the function dive fills in some details about the dive. It assumes that the diver breathes compressed air; the dive starts and ends at the surface (depth zero); the diver descends at the default descent rate of 30 metres per minute; and the diver ascends at the default ascent rate of 18 metres per minute. These defaults can be changed, as explained below.

Decompression Models

The quantity of nitrogen dissolved in the diver's body after a dive, as predicted by the classical Haldane theory, can be calculated using the function haldane. If d is a dive object then haldane(d) returns a vector containing the nitrogen tissue tensions (ata) at the end of the dive, in each of the 8 tissue compartments of the DSAT model. You can choose other compartment models; for example to use the classical US Navy model, type haldane(d, Halftimes[["USN"]]). For other alternative compartment models, see Halftimes, Workman65 or BuehlmannL16A.

To inspect the tissue tensions during the dive, use the interactive function showstates. This plots the dive and waits for you to click on a position in the graph. The tissue tensions at that instant are displayed as a bar plot.

Bubble theory calculations are not yet implemented. The total oxygen toxicity incurred during a dive can be computed by oxtox.

Nitrox calculations

A breathing gas is represented by an object of class "gas". The object air is a representation of compressed air (21% oxygen, 79% nitrogen) as an object of this class. (Don't reassign another value to this object!!!) Nitrox mixtures (mixtures of oxygen and nitrogen) can be represented using the function nitrox. For example, EAN 32 is represented by nitrox(0.32).

There are methods for print and summary for gas objects. Standard nitrox calculations are also available, for example ll{ ead equivalent air depth mod maximum operating depth maxmix richest nitrox mix for a given depth }

Diving on different gases

Remember that a "dive" object contains information about the breathing gas used. The breathing gas is determined when the dive object is created, and cannot be changed later. Information about the breathing gas is passed to the function dive when it creates the dive object. The function dive interprets its arguments as a sequence of actions or events occurring during the dive. If an argument is a vector of length 2, it is interpreted as c(depth,time) specifying the depth and duration of a stage of the dive. If the argument is a single number, it is interpreted as a depth, meaning that the diver ascends or descends to this depth.

Each argument to dive may also be a "gas" object, like nitrox(0.32), which means that the diver switches to this gas. So, for example, dive(nitrox(0.32), c(30,20)) means a dive to 30 metres for 20 minutes conducted on EAN 32 (Nitrox 0.32) from start to finish. The command dive(c(30,20), 5, nitrox(0.36), c(5,3)) means a dive on air to 30 metres for 20 minutes, ascending to 5 metres while breathing air, then switching to EAN 36 for a safety stop at 5 metres for 3 minutes.

The total oxygen toxicity incurred by a diver on any Nitrox dive can be calculated using oxtox.

Licence

This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package.

Details

scuba is a package for performing calculations in the theory of scuba diving. The package supports
  • creation, manipulation and plotting of dive profiles
  • decompression models
  • gas toxicity calculations.
The scuba package is intended only for use in research and education about the mathematical and statistical basis of decompression theory. It is not designed for actual use in scuba diving and related activities. See the disclaimer in scuba.disclaimer.