Learn R Programming

sqlm (version 0.1.0)

orbital.lm_sql_result: Convert an lm_sql_result to an orbital object

Description

Creates an orbital object from a fitted SQL linear model, enabling in-database predictions without pulling data into R.

Usage

orbital.lm_sql_result(x, ..., prefix = ".pred")

Value

An `orbital_class` object.

Arguments

x

An `lm_sql_result` object.

...

Not used.

prefix

Column name for predictions. Defaults to `".pred"`.

Details

Builds a single prediction expression by combining the fitted coefficients with the R expressions stored in `term_expressions`. For categorical predictors, the expression includes `ifelse()` calls that dbplyr translates to SQL `CASE WHEN`. The resulting `orbital_class` object can be used with [orbital::predict()] to get predictions or [orbital::augment()] to append a `.pred` column to a database table.