Problem
dskewnorm passes log straight through to sn::dsn, but dskewlnorm tests it with isTRUE() (R/skewlnorm.R:48):
lik <- if (isTRUE(log)) log_lik else exp(log_lik)
isTRUE() is FALSE for anything that isn't a length-1 logical TRUE, so numeric and character values silently fall through to the non-log branch instead of being coerced or rejected.
Reproduction
dskewnorm(1, 0, 1, 2, log = 1) #> -0.7488043 (log density)
dskewlnorm(1, 0, 1, 2, log = 1) #> 0.3989423 (NOT the log density)
dskewnorm(1, 0, 1, 2, log = "a") #> Error: argument is not interpretable as logical
dskewlnorm(1, 0, 1, 2, log = "a") #> 0.3989423 (silently ignored)
dnorm(1, log = "a") #> -1.418939 + coercion warning (base R reference)
The silent log = "a" case is the worst of these — a typo'd argument produces a plausible-looking number with no signal.
Suggestion
Validate log explicitly in both functions (e.g. chk_flag(log)) so the two agree with each other and fail loudly on garbage input, then use the validated flag. dskewlnorm needs to keep computing on the log scale internally for the Jacobian, so the if/exp() structure can stay — it's just the test that should change.
Problem
dskewnormpasseslogstraight through tosn::dsn, butdskewlnormtests it withisTRUE()(R/skewlnorm.R:48):isTRUE()isFALSEfor anything that isn't a length-1 logicalTRUE, so numeric and character values silently fall through to the non-log branch instead of being coerced or rejected.Reproduction
The silent
log = "a"case is the worst of these — a typo'd argument produces a plausible-looking number with no signal.Suggestion
Validate
logexplicitly in both functions (e.g.chk_flag(log)) so the two agree with each other and fail loudly on garbage input, then use the validated flag.dskewlnormneeds to keep computing on the log scale internally for the Jacobian, so theif/exp()structure can stay — it's just the test that should change.