Skip to content
Snippets Groups Projects
Commit c0f61eab authored by Sebastian Henz's avatar Sebastian Henz
Browse files

Remove last remnants of hormesis_index argument,

closes #14
parent 0f474df3
No related branches found
No related tags found
1 merge request!3V2.0
......@@ -81,15 +81,16 @@ ecxsys <- function(concentration,
if (length(concentration) > length(unique(concentration))) {
stop("Concentrations must be unique.")
}
if (length(hormesis_concentration) != 1) {
stop("hormesis_concentration must be a single number.")
}
if (!hormesis_concentration %in% concentration) {
stop("hormesis_concentration must equal one of the concentration values.")
}
hormesis_index = which(hormesis_concentration == concentration)
if (length(hormesis_index) != 1) {
stop("hormesis_index must be a single integer.")
} else if (hormesis_index <= 2 || hormesis_index >= length(concentration)) {
stop("hormesis_index must be greater than 2 and less than ",
"(length(concentration)).")
if (hormesis_index <= 2 || hormesis_index >= length(concentration)) {
stop("hormesis_concentration must be greater than the lowest ",
"non-control concentration and less than the highest concentration")
}
if (is.null(effect_tox_env_observed)) {
with_env <- FALSE
......@@ -122,11 +123,11 @@ ecxsys <- function(concentration,
}
if (any(concentration < 0)) {
stop("Concentrations must be >= 0")
} else if (min(concentration) > 0) {
}
if (min(concentration) > 0) {
stop("No control is given. The first concentration must be 0.")
} else {
min_conc <- 10 ^ floor(log10(concentration[2]) - conc_shift)
}
min_conc <- 10 ^ floor(log10(concentration[2]) - conc_shift)
# scale observed effect -----------------------------------------------
......
......@@ -10,18 +10,6 @@ mod <- ecxsys(
)
test_that("error when both hormesis arguments passed to ecxsys", {
expect_error(
ecxsys(
effect_tox_observed = c(85, 76, 94, 35, 0),
concentration = c(0, 0.03, 0.3, 3, 10),
hormesis_index = 3,
hormesis_concentration = 0.3
)
)
})
test_that("error when hormesis_concentration not in concentration", {
expect_error(
ecxsys(
......@@ -36,30 +24,30 @@ test_that("error when hormesis_concentration not in concentration", {
test_that("error when hormesis_index <= 2 or >= (length(concentration))", {
expect_error(
ecxsys(
effect_tox_observed = c(85, 76, 94, 35, 0),
concentration = c(0, 0.03, 0.3, 3, 10),
hormesis_index = 1
hormesis_concentration = 0,
effect_tox_observed = c(85, 76, 94, 35, 0)
)
)
expect_error(
ecxsys(
effect_tox_observed = c(85, 76, 94, 35, 0),
concentration = c(0, 0.03, 0.3, 3, 10),
hormesis_index = 2
hormesis_concentration = 0.03,
effect_tox_observed = c(85, 76, 94, 35, 0)
)
)
expect_error(
ecxsys(
effect_tox_observed = c(85, 76, 94, 35, 0),
concentration = c(0, 0.03, 0.3, 3, 10),
hormesis_index = 5
hormesis_concentration = 10,
effect_tox_observed = c(85, 76, 94, 35, 0)
)
)
expect_error(
ecxsys(
effect_tox_observed = c(85, 76, 94, 35, 0),
concentration = c(0, 0.03, 0.3, 3, 10),
hormesis_index = 6
hormesis_concentration = 30,
effect_tox_observed = c(85, 76, 94, 35, 0)
)
)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment