From b1bed60d40f10a5f17ab1ee04ec77d835832d69d Mon Sep 17 00:00:00 2001 From: "taha@luxor" Date: Thu, 1 Dec 2016 16:41:39 +0100 Subject: [PATCH] Potentials vs SHE now converted to SHE. Previous behaviour returned NAs for values that were already vs SHE. That issue now fixed. The fix included added SHE (zero at all temperatures) to as.SHE.data. --- DESCRIPTION | 2 +- R/unit-converters-electrochemical.R | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 887401a..a56c452 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: common Type: Package Title: chepec common -Version: 0.0.0.9002 +Version: 0.0.0.9003 Description: Commonly used functions and scripts. Authors@R: person("Taha", "Ahmed", email = "taha@chepec.se", role = c("aut", "cre")) License: GPL-3 diff --git a/R/unit-converters-electrochemical.R b/R/unit-converters-electrochemical.R index df1240d..d7c456d 100644 --- a/R/unit-converters-electrochemical.R +++ b/R/unit-converters-electrochemical.R @@ -179,7 +179,11 @@ potentials.as.SHE <- function() { "Hg2Cl2/Hg", "KCl(aq)", "4.2", "saturated", "30", "0.241", "6", "Sawyer1995", "Hg2Cl2/Hg", "KCl(aq)", "4.2", "saturated", "35", "0.238", "6", "Sawyer1995", "Hg2Cl2/Hg", "KCl(aq)", "4.2", "saturated", "40", "0.234", "6", "Sawyer1995", - "AVS", "", "", "", "25", "-4.44", "7", "Trasatti1986"), + "AVS", "", "", "", "25", "-4.44", "7", "Trasatti1986", + "SHE", "", "", "", "-273.15", "0.00", "8", "Inzelt2013", + "SHE", "", "", "", "0", "0.00", "8", "Inzelt2013", + "SHE", "", "", "", "25", "0.00", "8", "Inzelt2013", + "SHE", "", "", "", "580", "0.00", "8", "Inzelt2013"), ncol = 8, byrow = TRUE), stringsAsFactors = FALSE) @@ -283,6 +287,12 @@ as.SHE <- function(potential, # add column to hold calc potential vs SHE df$SHE <- as.numeric(NA) + # SHE scale special considerations + # 1. concentration is constant + if (any(df$scale == RefCanonicalName("SHE"))) { + df$concentration[which(df$scale == RefCanonicalName("SHE"))] <- "" + } + # AVS scale special considerations # 1. concentration is meaningless # 2. direction is opposite of electrochemical scales, requiring change of sign