Closed Mark-Eis closed 6 months ago
Not quite there yet—different to retriever()
as X
not a DF. Needs further consideration…
Not quite there yet—different to
retriever()
asX
not a DF. Needs further consideration…
OK, using eval_tidy()
to resolve quosure
, not data mask
Nevertheless, code improved: –
boxcox3 <- function(x, labile_data = TRUE) {
if (labile_data) {
x <- enquo(x)
function(lambda) {
eval_tidy(
if (lambda == 0)
expr(log(!!x))
else
expr(((!!x) ^ lambda - 1) / lambda)
)
}
} else
function(lambda) {
if (lambda == 0)
log(x)
else
(x ^ lambda - 1) / lambda
}
}
https://github.com/Mark-Eis/BitsnBobs/blob/bb2d9200117a1ddd54e746ce0ff4ed3460dc17e1/R/boxcox.R#L71
see: –
https://github.com/Mark-Eis/BitsnBobs/blob/bb2d9200117a1ddd54e746ce0ff4ed3460dc17e1/R/retriever.R#L109