Skip to content

Commit

Permalink
Rephrase an error message and two warnings from calc_Huntley2006().
Browse files Browse the repository at this point in the history
  • Loading branch information
mcol committed Dec 18, 2024
1 parent 80c1fcb commit 77387de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions R/calc_Huntley2006.R
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,8 @@ calc_Huntley2006 <- function(

## Check 'data'
if (ncol(data) == 2) {
.throw_warning("'data' only had two columns. We assumed that the ",
"errors on LxTx were missing and automatically added ",
"a 5% error.\n",
.throw_warning("'data' has only two columns: we assume that the errors ",
"on LxTx are missing and automatically add a 5% error.\n",
"Please provide a data frame with three columns ",
"if you wish to use actually measured LxTx errors.")
data[ ,3] <- data[ ,2] * 0.05
Expand Down Expand Up @@ -381,15 +380,15 @@ calc_Huntley2006 <- function(
if (is.numeric(rhop)) {
.validate_length(rhop, 2)

# alternatively, and RLum.Results object produced by analyse_FadingMeasurement()
# alternatively, an RLum.Results object produced by analyse_FadingMeasurement()
# can be provided
} else if (inherits(rhop, "RLum.Results")) {

if (rhop@originator == "analyse_FadingMeasurement")
rhop <- c(rhop@data$rho_prime$MEAN,
rhop@data$rho_prime$SD)
else
.throw_error("'rhop' accepts RLum.Results objects only if produced ",
.throw_error("'rhop' accepts only RLum.Results objects produced ",
"by 'analyse_FadingMeasurement()'")
}

Expand Down Expand Up @@ -653,10 +652,10 @@ calc_Huntley2006 <- function(
" The De and age should be regarded as infinite estimates.")

if (Ln < min(LxTx.sim) * 0.95 && GC.settings$mode != "extrapolation")
.throw_warning("Ln/Tn is smaller than the minimum computed LxTx value",
"If, in consequence, your age result is NA, either your ",
.throw_warning("Ln/Tn is smaller than the minimum computed LxTx value: ",
"if, in consequence, your age result is NA, either your ",
"input values are unsuitable, or you should consider using ",
"a different model for your dataset")
"a different model for your data")

if (is.na(D0.sim.Gy)) {
.throw_error("Simulated D0 is NA: either your input values are unsuitable, ",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_calc_Huntley2006.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test_that("input validation", {
expect_error(calc_Huntley2006(data, rhop = "test"),
"'rhop' should be of class 'numeric' or 'RLum.Results'")
expect_error(calc_Huntley2006(data, rhop = rhop.test),
"'rhop' accepts RLum.Results objects only if produced by")
"'rhop' accepts only RLum.Results objects produced by")
expect_error(calc_Huntley2006(data, rhop = c(-1, 4.9e-7)),
"'rhop' must be a positive number")

Expand Down Expand Up @@ -82,7 +82,7 @@ test_that("input validation", {
expect_warning(calc_Huntley2006(data[, 1:2], rhop = rhop, n.MC = 2,
ddot = ddot, readerDdot = readerDdot,
fit.method = "GOK"),
"'data' only had two columns")
"'data' has only two columns: we assume that the errors")
})

expect_warning(expect_error(
Expand Down

0 comments on commit 77387de

Please sign in to comment.