From e5a077e28153f6494c99d6945b8b1bd239464609 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 8 Feb 2019 15:25:19 +0100 Subject: Make SSLRC and PEC drainage UK accept NA for Koc --- R/SSLRC_mobility_classification.R | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'R') diff --git a/R/SSLRC_mobility_classification.R b/R/SSLRC_mobility_classification.R index deda5cf..2f8fb34 100644 --- a/R/SSLRC_mobility_classification.R +++ b/R/SSLRC_mobility_classification.R @@ -1,4 +1,4 @@ -# Copyright (C) 2015 Johannes Ranke +# Copyright (C) 2015,2018 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package pfm @@ -30,12 +30,16 @@ SSLRC_mobility_classification <- function(Koc) { if (!is.numeric(Koc) | length(Koc) != 1) stop("Please give a single number") - result <- list("Non mobile", 0.01) - if (Koc < 4000) result <- list("Slightly mobile", 0.02) - if (Koc < 1000) result <- list("Slightly mobile", 0.5) - if (Koc < 500) result <- list("Moderately mobile", 0.7) - if (Koc < 75) result <- list("Mobile", 1.9) - if (Koc < 15) result <- list("Very mobile", 1.9) + if (is.na(Koc)) { + result <- list(NA, NA) + } else { + result <- list("Non mobile", 0.01) + if (Koc < 4000) result <- list("Slightly mobile", 0.02) + if (Koc < 1000) result <- list("Slightly mobile", 0.5) + if (Koc < 500) result <- list("Moderately mobile", 0.7) + if (Koc < 75) result <- list("Mobile", 1.9) + if (Koc < 15) result <- list("Very mobile", 1.9) + } names(result) <- c("Mobility classification", "Percentage drained per mm of drain water") return(result) -- cgit v1.2.1