R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("seacarb-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('seacarb') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "K1" > > ### * K1 > > flush(stderr()); flush(stdout()) > > ### Name: K1 > ### Title: First dissociation constant of carbonic acid (mol/kg) > ### Aliases: K1 > ### Keywords: utilities > > ### ** Examples > > K1(35,25,0) [1] 1.392108e-06 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "K1p" > > ### * K1p > > flush(stderr()); flush(stdout()) > > ### Name: K1p > ### Title: First dissociation constant of phosphoric acid (mol/kg) > ### Aliases: K1p > ### Keywords: utilities > > ### ** Examples > > K1p(35,25,0) [1] 0.0244427 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "K2" > > ### * K2 > > flush(stderr()); flush(stdout()) > > ### Name: K2 > ### Title: Second dissociation constant of carbonic acid (mol/kg) > ### Aliases: K2 > ### Keywords: utilities > > ### ** Examples > > K2(35,25,0) [1] 1.188725e-09 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "K2p" > > ### * K2p > > flush(stderr()); flush(stdout()) > > ### Name: K2p > ### Title: Second dissociation constant of phosphoric acid (mol/kg) > ### Aliases: K2p > ### Keywords: utilities > > ### ** Examples > > K2p(35,25,0) [1] 1.092035e-06 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "K3p" > > ### * K3p > > flush(stderr()); flush(stdout()) > > ### Name: K3p > ### Title: Third dissociation constant of phosphoric acid (mol/kg) > ### Aliases: K3p > ### Keywords: utilities > > ### ** Examples > > K3p(35,25,0) [1] 1.624299e-09 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kb" > > ### * Kb > > flush(stderr()); flush(stdout()) > > ### Name: Kb > ### Title: Dissociation constant of boric acid (mol/kg) > ### Aliases: Kb > ### Keywords: utilities > > ### ** Examples > > Kb(35,25,0,0) [1] 2.526573e-09 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kf" > > ### * Kf > > flush(stderr()); flush(stdout()) > > ### Name: Kf > ### Title: Stability constant of hydrogen fluorid (mol/kg) > ### Aliases: Kf > ### Keywords: utilities > > ### ** Examples > > Kf(35,25,0,0) [1] 0.003031787 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kh" > > ### * Kh > > flush(stderr()); flush(stdout()) > > ### Name: Kh > ### Title: Henry's constant mol/(kg/atm) > ### Aliases: Kh > ### Keywords: utilities > > ### ** Examples > > Kh(35,25,0) [1] 0.02839188 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Ks" > > ### * Ks > > flush(stderr()); flush(stdout()) > > ### Name: Ks > ### Title: Stability constant of hydrogen sulfate (mol/kg) > ### Aliases: Ks > ### Keywords: utilities > > ### ** Examples > > Ks(35,25,0) [1] 0.1003021 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kspa" > > ### * Kspa > > flush(stderr()); flush(stdout()) > > ### Name: Kspa > ### Title: Solubility product of aragonite (mol/kg) > ### Aliases: Kspa > ### Keywords: utilities > > ### ** Examples > > Kspa(35,25,0) [1] 6.481759e-07 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kspc" > > ### * Kspc > > flush(stderr()); flush(stdout()) > > ### Name: Kspc > ### Title: Solubility product of calcite (mol/kg) > ### Aliases: Kspc > ### Keywords: utilities > > ### ** Examples > > Kspc(35,25,0) [1] 4.272351e-07 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "Kw" > > ### * Kw > > flush(stderr()); flush(stdout()) > > ### Name: Kw > ### Title: Ion product of water (mol2/kg2) > ### Aliases: Kw > ### Keywords: utilities > > ### ** Examples > > Kw(35,25,0,0) [1] 6.062772e-14 attr(,"unit") [1] "mol2/kg2" > > > > cleanEx(); ..nameEx <- "bor" > > ### * bor > > flush(stderr()); flush(stdout()) > > ### Name: bor > ### Title: Total boron concentration (mol/kg) > ### Aliases: bor > ### Keywords: utilities > > ### ** Examples > > bor(35,25,0) [1] 0.000416 attr(,"unit") [1] "mol/kg" > > > > cleanEx(); ..nameEx <- "carb" > > ### * carb > > flush(stderr()); flush(stdout()) > > ### Name: carb > ### Title: Parameters of the seawater carbonate system > ### Aliases: carb > ### Keywords: utilities > > ### ** Examples > ## Not run: ##Data entry via the keyboard > carb(8, 8.2, 2400, 35, 25, 0) Salinity: 35 Temperature: 25 oC Pressure: 0 bar pH: 8.2 CO2: 7.477544e-06 (mol/kg) pCO2: 263.3691 (uatm) fCO2: 262.54 (uatm) HCO3: 0.001649802 (mol/kg) CO3: 0.0003108231 (mol/kg) DIC: 0.001968102 (mol/kg) ALK: 0.0024 (mol/kg) Omega aragonite: 4.929621 Omega calcite: 7.478931 PhiD: -1369.120 BetaD: 8.160777 PiD: 1.092065 PhiB: -182.8422 BetaB: 1.956302 PiB: 0.2617900 PhiC: 1003.436 BetaC: -4.248173 PiC: -0.5684854 PhiH: -1186.278 PiH: 0.8302753 Warning in write.table(res, resultat, sep = "\t", append = TRUE, row.names = FALSE) : appending column names to file > > ## Not run: The input parameters are pH=8.2, total alkalinity = 2400 umol/kg, > ##D Salinity = 35, temperature = 25 oC and pressure = 0 bar (that is surface water) > ##D > ##D The output is: > ##D > ##D Salinity: 35 > ##D Temperature: 25 oC > ##D Pressure: 0 bar > ##D pH: 8.2 > ##D CO2: 7.477544e-06 (mol/kg) > ##D pCO2: 263.3691 (uatm) > ##D fCO2: 262.54 (uatm) > ##D HCO3: 0.001649802 (mol/kg) > ##D CO3: 0.0003108231 (mol/kg) > ##D DIC: 0.001968102 (mol/kg) > ##D ALK: 0.0024 (mol/kg) > ##D Omega aragonite: 4.929621 > ##D Omega calcite: 7.478931 > ##D PhiD: -1369.120 > ##D BetaD: 8.160777 > ##D PiD: 1.092065 > ##D PhiB: -182.8422 > ##D BetaB: 1.956302 > ##D PiB: 0.2617900 > ##D PhiC: 1003.436 > ##D BetaC: -4.248173 > ##D PiC: -0.5684854 > ##D PhiH: -1186.278 > ##D PiH: 0.8302753 > ##D > ##D ## Data entry via a file > ##D carb(ini = "f") > ##D > ##D The file must be located in your home directory and provide the column names > ##D (these names MUST match the names listed above) and the data must be separated > ##D by tabs. Note that, in contrast to the keyboard input, variables used in the > ##D file input must be in mol/kg. > ##D > ##D For example: > ##D > ##D flag PH ALK S T P > ##D 8 8.2 2400e-6 35 20 0 > ##D 8 8.2 2400e-6 35 20 0 > ##D > ## End(Not run) > > > > cleanEx(); ..nameEx <- "rho" > > ### * rho > > flush(stderr()); flush(stdout()) > > ### Name: rho > ### Title: Density of seawater (kg/m3) > ### Aliases: rho > ### Keywords: utilities > > ### ** Examples > > rho(35,25,0) [1] 1023.343 attr(,"unit") [1] "(kg/m3)" > > > > ### *