1.4 Formulas and named data
The family procedures, such as elnet-fit and logistic-path, take a design matrix and a separate response, and their coefficients are known by position. Data usually arrives as a table of named columns instead, one of which is the response. The formula front end, which Fitting from named columns and Named data introduce, fits a model from such a table: a formula names the response and the predictors, and the fitted model keeps the names, so that its coefficients are keyed by name and it predicts from a new table by matching columns by name. The same three procedures fit every family: formula-fit at one λ, formula-path along a regularization path and formula-cv with cross-validation.
R’s glmnet itself has no formula interface; the R package glmnetUtils adds one, which this front end resembles (see Matching R).