# NOT RUN {
as.fun(mean)
as.fun("mean")
as.fun("edit")
as.fun("stats::predict")
## the constant function '1'
f <- as.fun(1)
f(2) # 1
f("a") # 1
## the constant function 'FALSE'
f <- as.fun(FALSE)
f(2) # FALSE
f("a") # FALSE
f <- as.fun(data.frame(x = 1:2, y = 2:3))
f("x") # 'x' column
f("y") # 'y' column
# }
Run the code above in your browser using DataLab