Predict method for an object of class "flashlight".
Pass additional elements to update the flashlight, typically data
.
# S3 method for class 'flashlight'
predict(object, ...)
A vector with predictions.
fit <- lm(Sepal.Length ~ ., data = iris)
fl <- flashlight(model = fit, data = iris, y = "Sepal.Length", label = "ols")
predict(fl)[1:5]
#> 1 2 3 4 5
#> 5.004788 4.756844 4.773097 4.889357 5.054377
predict(fl, data = iris[1:5, ])
#> 1 2 3 4 5
#> 5.004788 4.756844 4.773097 4.889357 5.054377