toSql: Create SQL function definition from linear model

toSqlR Documentation

Create SQL function definition from linear model

Description

Generates a user-defined SQL function from a fitted linear model which can then be used for prediction.

Usage

toSql(
  model,
  fn_title,
  numeric_type = "NUMERIC(24, 6)",
  return_type = "NUMERIC(10,6)",
  ...
)

## S4 method for signature 'lm'
toSql(model, fn_title, numeric_type, return_type)

Arguments

model

Model to create SQL function from

fn_title

Name of function to create. Should generally include the schema

numeric_type

SQL type to use for numeric parameters. This is also used in the coefficient definitions

return_type

SQL type of return value

...

Additional arguments

Value

Response

Examples

fitted_model <- lm(mpg ~ cyl + wt, data=mtcars)
toSql(fitted_model, "dbo.PredictModel")


bairdj/lm2sql documentation built on April 5, 2022, 12:05 a.m.