Learn R Programming

toaster (version 0.2.5)

computeLm: Fit Linear Model and return its coefficients.

Description

Outputs coefficients of the linear model fitted to Aster table according to the formula expression containing column names. The zeroth coefficient corresponds to the slope intercept. R formula expression with column names for response and predictor variables is exactly as in lm function (though less features supported).

Usage

computeLm(channel, tableName, expr, where = NULL,
    test = FALSE)

Arguments

channel
connection object as returned by odbcConnect
tableName
Aster table name
expr
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under `Details`.
where
specifies criteria to satisfy by the table rows before applying computation. The creteria are expressed in the form of SQL predicates (inside WHERE clause).
test
logical: if TRUE show what would be done, only (similar to parameter test in RODBC functions like sqlQuery and sqlSave).

Value

  • Outputs data frame containing 3 columns: [object Object],[object Object],[object Object]

Details

Models for computeLm are specified symbolically. A typical model has the form response ~ terms where response is the (numeric) column and terms is a series of column terms which specifies a linear predictor for response. A terms specification of the form first + second indicates all the terms in first together with all the terms in second with duplicates removed. A specification of the form first:second and first*second (interactions) are not supported yet.

Examples

Run this code
model1 = computeLm(channel=conn, tableName="batting_enh", expr= ba ~ rbi + bb + so)

Run the code above in your browser using DataLab