Bumped version number. Cleaned up Rd files.

Added info and links to README.
master
Taha Ahmed 4 years ago
parent f96a3dc92e
commit 77ae28f0d4

@ -1,12 +1,13 @@
Package: common
Type: Package
Title: chepec common
Version: 0.0.0.9012
Version: 0.0.1.9000
Description: Commonly used functions and scripts.
Authors@R: person("Taha", "Ahmed", email = "taha@chepec.se", role = c("aut", "cre"))
License: GPL-3
Encoding: UTF-8
LazyData: TRUE
RoxygenNote: 6.0.1
RoxygenNote: 6.1.1
Imports:
stats,
knitr,

@ -1,31 +1,22 @@
# Generated by roxygen2: do not edit by hand
export(AVS2SHE)
export(Celsius2Kelvin)
export(ConvertRefPot)
export(ExtractSampleIdString)
export(GenericXtableSetAttributes)
export(Kelvin2Celsius)
export(LoadRData2Variable)
export(LongtableXtableHeader)
export(OxygenSolubilityWater)
export(ProvideSampleId)
export(RefCanonicalName)
export(SHE2AVS)
export(SubfigureGenerator)
export(SubstrateHistory)
export(TabularXtableHeader)
export(VapourPressureWater)
export(as.SHE)
export(as.degrees)
export(as.radians)
export(from.SHE)
export(int2padstr)
export(is.wholenumber)
export(molarity2mass)
export(numbers2words)
export(pascal2torr)
export(potentials.as.SHE)
export(roundup)
export(simpleCap)
export(siunitx.uncertainty)

@ -2,6 +2,10 @@
Includes common numerical functions and some LaTeX-specific functions.
Note that the package is named `common`, despite the repository having a different name.
[This repository is mirrored on my Gitea](https://git.chepec.se/taha/common).
## NOTE: the electrochemical reference electrode functions

@ -1,17 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{AVS2SHE}
\alias{AVS2SHE}
\title{AVS -> SHE}
\usage{
AVS2SHE(avs)
}
\arguments{
\item{avs}{Potential in AVS scale}
}
\value{
potential in SHE scale (numeric)
}
\description{
Converts from absolute vacuum scale (AVS) to SHE scale
}

@ -1,21 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{ConvertRefPot}
\alias{ConvertRefPot}
\title{Convert from one electrochemical scale to another}
\usage{
ConvertRefPot(argpotential, argrefscale, valuerefscale)
}
\arguments{
\item{argpotential}{potential (numeric)}
\item{argrefscale}{input reference scale (char string)}
\item{valuerefscale}{output reference scale (char string)}
}
\value{
potential in output reference scale (numeric)
}
\description{
Convert from one electrochemical scale to another
}

@ -1,25 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{ConvertRefPotEC}
\alias{ConvertRefPotEC}
\title{ConvertRefPotEC}
\usage{
ConvertRefPotEC(argpotential, argrefscale, valuerefscale)
}
\arguments{
\item{argpotential}{potential (numeric)}
\item{argrefscale}{input reference scale (character string)}
\item{valuerefscale}{output reference scale (character string)}
}
\value{
potential in output reference scale (numeric)
}
\description{
This function does the heavy lifting.
Converts from an electrochemical reference scale into another.
SHE: standard hydrogen electrode
Ag/AgCl: silver silver-chloride electrode (3M KCl)
SCE: saturated calomel electrode
}

@ -1,65 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/chemistry-tools.R
\name{OxygenSolubilityWater}
\alias{OxygenSolubilityWater}
\title{Oxygen solubility in water}
\usage{
OxygenSolubilityWater(temperature)
}
\arguments{
\item{temperature}{numeric, vector. In degrees Celsius.}
}
\value{
a dataframe with the following columns:
+ "temperature" same as the supplied temperature
+ "g/cm-3" oxygen solubility expressed as gram per cubic cm
+ "mg/L" ditto expressed as milligram per litre
+ "mol/L" ditto expressed as moles per litre (molarity)
+ "permoleculewater" number of O2 molecules per molecule of water
Note: mg/L is equivalent to ppm by weight (since water has approx
unit density in the temperature range 0-50 Celsius).
}
\description{
Oxygen solubility in water which is in contact with
air saturated with water vapour, as a function of
temperature and at a total pressure of 760 torr.
}
\details{
Some background: as the temperature of a gasesous solution is raised the
gas is driven off until complete degassing occurs at the boiling point
of the solvent. This variation of solubility with temperature can be
derived from thermodynamic first principles.
But the variation of oxygen solubility in water cannot be represented by a
simple relationship (derived from thermodynamic first principles), and so
more complicated expressions which are fitted to empirical data have
to be used.
Hitchman, Measurement of Dissolved Oxygen, 1978 reproduce a table by
Battino and Clever (1966) that presents experimental values of the
so-called Bunsen absorption coefficient (this is the volume of gas, at 0 C
and 760 torr, that, at the temperature of measurement, is dissolved in one
volume of the solvent when the partial pressure of the gas is 760 torr)
recorded by eleven research groups up until 1965. The standard error of the
mean value is never greater +-0.5%. The mean values from this table are
probably accurate enough for most applications.
Hitchman notes that the data in this table can be fitted by two forms of
equations: one form obtained from Henry's law (under the restriction that
the partial pressure of the gas remains constant), and another form by
describing the variation with temperature by fitting a general power series.
The latter approach is used in this function.
Hitchman chooses to fit a fourth degree polynomial, and found that the
square of the correlation coefficient was 0.999996.
For more background and detailed derivation of the formula used here,
see section 2.2 (pp. 11) in Hitchman.
This formula is strictly speaking only valid for 0 < T < 50 celsius.
The function will return values outside this range, but with a warning.
}
\examples{
\dontrun{
OxygenSolubilityWater(22)
OxygenSolubilityWater(c(2, 7, 12, 30))
}
}

@ -1,24 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{RefCanonicalName}
\alias{RefCanonicalName}
\title{Get standardised name of reference electrode}
\usage{
RefCanonicalName(refname)
}
\arguments{
\item{refname}{string or a vector of strings}
}
\value{
vector with corresponding "canonical" name or empty string (if none found)
}
\description{
Given a reference electrode label, this function returns its canonical name
(as defined by this package).
This function tries to match against as many variations as possible for each
reference electrode.
The entire point of this function is to decrease the mental load on the user
by not requiring them to remember a particular label or name for each reference
electrode, instead almost any sufficiently distinct label or string will still
be correctly identified.
}

@ -1,17 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{SHE2AVS}
\alias{SHE2AVS}
\title{SHE -> AVS}
\usage{
SHE2AVS(she)
}
\arguments{
\item{she}{Potential in SHE scale}
}
\value{
potential in AVS scale (numeric)
}
\description{
Converts from SHE scale to absolute vacuum (AVS) scale
}

@ -1,25 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/chemistry-tools.R
\name{VapourPressureWater}
\alias{VapourPressureWater}
\title{Vapour pressure of water}
\usage{
VapourPressureWater(temperature)
}
\arguments{
\item{temperature}{numeric vector, in degrees Celsius}
}
\value{
vapour pressure of water, in kilopascal
}
\description{
Vapour pressure of water as a function of temperature
This function returns the vapour pressure of water at the given
temperature(s) from the common::vapourwater dataset.
}
\examples{
\dontrun{
VapourPressureWater(45)
VapourPressureWater(c(20, 25, 45, 60))
}
}

@ -1,29 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{as.SHE}
\alias{as.SHE}
\title{Convert from electrochemical or physical scale to SHE}
\usage{
as.SHE(potential, scale, electrolyte = "", concentration = "saturated",
temperature = 25, as.SHE.data = potentials.as.SHE())
}
\arguments{
\item{potential}{potential in volt}
\item{scale}{name of the original scale}
\item{electrolyte}{optional, specify electrolyte solution, e.g., "KCl(aq)". Must match value in \code{as.SHE.data$electrolyte}.}
\item{concentration}{of electrolyte in mol/L, or as the string "saturated"}
\item{temperature}{of system in degrees Celsius}
\item{as.SHE.data}{dataframe with dataset}
}
\value{
potential in SHE scale
}
\description{
Convert an arbitrary number of potentials against any known electrochemical
scale (or the electronic vacuum scale) to potential vs SHE.
}

@ -1,30 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{from.SHE}
\alias{from.SHE}
\title{Convert from SHE scale to another electrochemical or physical scale}
\usage{
from.SHE(potential, scale, electrolyte = "", concentration = "saturated",
temperature = 25, as.SHE.data = potentials.as.SHE())
}
\arguments{
\item{potential}{potential in volt}
\item{scale}{name of the target scale}
\item{electrolyte}{optional, specify electrolyte solution, e.g., "KCl(aq)". Must match one of the values in \code{\link{potentials.as.SHE}$electrolyte}}
\item{concentration}{of electrolyte in mol/L, or as the string "saturated"}
\item{temperature}{of system in degrees Celsius}
\item{as.SHE.data}{by default this parameter reads the full dataset \code{\link{potentials.as.SHE}}}
}
\value{
potential in the specified target scale
}
\description{
Convert an arbitrary number of potentials vs SHE to another electrochemical
scale (or the vacuum scale).
The available target scales are those listed by \code{\link{potentials.as.SHE}}.
}

@ -4,8 +4,8 @@
\alias{numbers2words}
\title{numbers2words}
\usage{
numbers2words(x, billion = c("US", "UK"), and = if (billion == "US") "" else
"and")
numbers2words(x, billion = c("US", "UK"), and = if (billion == "US") ""
else "and")
}
\arguments{
\item{x}{number}

@ -1,27 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unit-converters-electrochemical.R
\name{potentials.as.SHE}
\alias{potentials.as.SHE}
\title{Potentials as SHE}
\usage{
potentials.as.SHE()
}
\value{
tidy dataframe with the following columns
\tabular{ll}{
\code{electrode} \tab reference electrode \cr
\code{electrolyte} \tab electrolyte \cr
\code{conc.num} \tab concentration of electrolyte, mol/L \cr
\code{conc.string} \tab concentration of electrolyte, as string, may also note temperature at which conc \cr
\code{temp} \tab temperature / degrees Celsius \cr
\code{SHE} \tab potential vs SHE / volt \cr
\code{sid} \tab set id, just for housekeeping inside this function \cr
\code{reference} \tab BibTeX reference \cr
\code{dEdT} \tab temperature coefficient / volt/kelvin \cr
}
}
\description{
This function just outputs a tidy dataframe with potential vs SHE for
different scales, electrolytes, concentrations, and temperatures.
Using data from literature.
}

@ -1,26 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{vapourwater}
\alias{vapourwater}
\title{Vapour pressure and other saturation properties of water}
\format{A data frame with 189 rows and 4 variables:
\describe{
\item{temperature}{temperature/celsius}
\item{pressure}{pressure/kilopascal}
\item{enthalpy}{enthalpy of vapourisation/kilojoule per kilogram}
\item{surfacetension}{surface tension/millinewton per metre}
}}
\source{
Handbook of Chemistry and Physics, 94th ed., 6-10-90, Eric W. Lemmon.
}
\description{
A dataset summarising vapour pressure, enthalpy of vapourisation,
and surface tension of water from 0.01 Celsius to 373.95 Celsius.
Data as accepted by the International Association for the Properties
of Water and Steam for general scientific use.
Source: CRC handbook, 94th ed., table 6-10-90, Eric W. Lemmon.
}
\author{
Taha Ahmed
}
Loading…
Cancel
Save