diff --git a/DESCRIPTION b/DESCRIPTION index c978d05..0afa22a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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, diff --git a/NAMESPACE b/NAMESPACE index 44eaa65..551f938 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/README.md b/README.md index c4dca65..6fdcf17 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/man/AVS2SHE.Rd b/man/AVS2SHE.Rd deleted file mode 100644 index e91ae96..0000000 --- a/man/AVS2SHE.Rd +++ /dev/null @@ -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 -} diff --git a/man/ConvertRefPot.Rd b/man/ConvertRefPot.Rd deleted file mode 100644 index 072fdf4..0000000 --- a/man/ConvertRefPot.Rd +++ /dev/null @@ -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 -} diff --git a/man/ConvertRefPotEC.Rd b/man/ConvertRefPotEC.Rd deleted file mode 100644 index 40b082e..0000000 --- a/man/ConvertRefPotEC.Rd +++ /dev/null @@ -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 -} diff --git a/man/OxygenSolubilityWater.Rd b/man/OxygenSolubilityWater.Rd deleted file mode 100644 index 29e2660..0000000 --- a/man/OxygenSolubilityWater.Rd +++ /dev/null @@ -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)) -} -} diff --git a/man/RefCanonicalName.Rd b/man/RefCanonicalName.Rd deleted file mode 100644 index e4e2c22..0000000 --- a/man/RefCanonicalName.Rd +++ /dev/null @@ -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. -} diff --git a/man/SHE2AVS.Rd b/man/SHE2AVS.Rd deleted file mode 100644 index b0ebe39..0000000 --- a/man/SHE2AVS.Rd +++ /dev/null @@ -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 -} diff --git a/man/VapourPressureWater.Rd b/man/VapourPressureWater.Rd deleted file mode 100644 index de874c7..0000000 --- a/man/VapourPressureWater.Rd +++ /dev/null @@ -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)) -} -} diff --git a/man/as.SHE.Rd b/man/as.SHE.Rd deleted file mode 100644 index 3101edf..0000000 --- a/man/as.SHE.Rd +++ /dev/null @@ -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. -} diff --git a/man/from.SHE.Rd b/man/from.SHE.Rd deleted file mode 100644 index a0c099f..0000000 --- a/man/from.SHE.Rd +++ /dev/null @@ -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}}. -} diff --git a/man/numbers2words.Rd b/man/numbers2words.Rd index 273457b..fdac64f 100644 --- a/man/numbers2words.Rd +++ b/man/numbers2words.Rd @@ -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} diff --git a/man/potentials.as.SHE.Rd b/man/potentials.as.SHE.Rd deleted file mode 100644 index 7af439c..0000000 --- a/man/potentials.as.SHE.Rd +++ /dev/null @@ -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. -} diff --git a/man/vapourwater.Rd b/man/vapourwater.Rd deleted file mode 100644 index 4f4c460..0000000 --- a/man/vapourwater.Rd +++ /dev/null @@ -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 -}