From dc0fcb0629da9b94e42403bd3936c09ce763e7f7 Mon Sep 17 00:00:00 2001 From: "taha@luxor" Date: Sun, 27 Nov 2016 00:49:58 +0100 Subject: [PATCH] Function that converts scale names is now accessible (exported). Capitalised scale names so they match more variations (remember, matching uses tolower(), so no need to start with lowercase). --- NAMESPACE | 1 + R/unit-converters-electrochemical.R | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 498237b..96ce5d1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(Kelvin2Celsius) export(LoadRData2Variable) export(LongtableXtableHeader) export(ProvideSampleId) +export(RefCanonicalName) export(SHE2AVS) export(SubfigureGenerator) export(SubstrateHistory) diff --git a/R/unit-converters-electrochemical.R b/R/unit-converters-electrochemical.R index 76b399f..28b62a4 100644 --- a/R/unit-converters-electrochemical.R +++ b/R/unit-converters-electrochemical.R @@ -39,34 +39,35 @@ SHE2AVS <- function(she) { #' @param refname string #' #' @return the canonical name or empty string +#' @export RefCanonicalName <- function(refname) { # scale names electrode.system <- list() electrode.system[["SHE"]] <- c("SHE", - "standard hydrogen", - "standard hydrogen electrode") + "Standard hydrogen", + "Standard hydrogen electrode") electrode.system[["AgCl/Ag"]] <- c("AgCl/Ag", "Ag/AgCl", "AgCl", - "silver-silver chloride", - "silver chloride", + "Silver-Silver chloride", + "Silver chloride", "SSC") # saturated silver-silver chloride is sometimes abbreviated SSC electrode.system[["Hg2Cl2/Hg"]] <- c("Hg2Cl2/Hg", "Hg/Hg2Cl2", "Hg2Cl2", - "calomel-mercury", - "mercury-calomel", + "Calomel-Mercury", + "Mercury-Calomel", "SCE") electrode.system[["AVS"]] <- c("AVS", - "vacuum", - "vacuum scale", - "absolute", - "absolute scale", - "absolute vacuum scale") + "Vacuum", + "Vacuum scale", + "Absolute", + "Absolute scale", + "Absolute vacuum scale") electrode.system[["Li"]] <- c("Li", "Li/Li+",