Learn R Programming

AquaEnv (version 1.0-4)

convert: convert

Description

PUBLIC function: converts either a single value (the pH scale of a pH value, the pH scale of a dissociation constant (K*), the unit of a concentration value), or all elements of a special unit or pH scale in an object of class aquaenv

Arguments

x
object to be converted: either a single value (pH value, K* value, or concentration value) or an object of class aquaenv
vartype
only valid if x is a single value: the type of x, either "pHscale", "KHscale", or "conc"
what
only valid if x is a single value: only valid if x is a single value: the type of conversion to be done, for pH scales one of "free2tot", "free2sws", "free2nbs", ... (any combination of "free", "tot", "sws", and "nbs"); for concentrations one of "molar2molal", "molar2molin", ... (any combination of "molar" (mol/l), "molal" (mol/kg-H2O), and "molin" (mol/kg-solution))
S
only valid if x is a single value: salinity (in practical salinity units: no unit)
t
only valid if x is a single value: temperature in degrees centigrade
p
only valid if x is a single value: gauge pressure (total pressure minus atmospheric pressure) in bars
SumH2SO4
only valid if x is a single value: total sulfate concentration in mol/kg-solution; if not supplied this is calculated from S
SumHF
only valid if x is a single value: total fluoride concentration in mol/kg-solution; if not supplied this is calculated from S
khf
only valid if x is a single value: either "dickson" (default, Dickson1979a) or "perez" (Perez1987a) for K\_HF
khso4
only valid if x is a single value: either "dickson" (default, Dickson1990) or "khoo" (Khoo1977) for K\_HSO4
from
only valid if x is an object of class aquaenv: the unit which needs to be converted (as a string; must be a perfect match)
to
only valid if x is an object of class aquaenv: the unit to which the conversion should go
factor
only valid if x is an object of class aquaenv: the conversion factor to be applied: can either be a number (e.g. 1000 to convert from mol to mmol), or any of the conversion factors given in an object of class aquaenv
convattr
only valid if x is an object of class aquaenv: which attribute should be converted? can either be "unit" or "pH scale"

Value

converted single value or object of class aquaenv with converted elements

Details

Possible usages are
convert(x, vartype, what, S, t, p, SumH2SO4, SumHF, khf)
convert(x, from, to, factor, convattr)