I have a "model" that is not of a recognized class with a predict method, but a user-defined function. How can I set this up so
predict(new_model) will return the function output?
model <- lm(Sepal.Length ~ ., data = iris) new_model <- function(data) (predict(data) - 5)^2 # want this to work # predict(new_model, iris)
Created on 2021-06-24 by the reprex package (v1.0.0)