Closed mcol closed 2 months ago
OK
Example of failure as as it computes n_breaks = -15.71539
:
data(ExampleData.Fading)
calc_WodaFuchs2008(ExampleData.Fading$fading.data$IR50)
# Error in hist.default(x = data[, 1], breaks = n_breaks, plot = FALSE) :
# invalid number of 'breaks'
Even simpler:
set.seed(1)
calc_WodaFuchs2008(data.frame(rnorm(20, 10), rnorm(20, 0.5)))
# Error in hist.default(x = data[, 1], breaks = n_breaks, plot = FALSE) :
# invalid number of 'breaks'
Fixed by #198.
The division is misplaced, as it operates only on
min(.)
rather than onmax(.) - min(.)
https://github.com/R-Lum/Luminescence/blob/759a1142651cc557f9fd06c6b061d1aff244cdf9/R/calc_WodaFuchs2008.R#L121-L124
This can be more compactly be rewritten as
diff(range(.)) / bin_width
.