This function extracts the term labels from the right-hand side of a given R formula. If an intercept is to be included (and a name for the intercept is provided), it will be added as the first element of the returned vector.
Value
A character vector containing the term labels. If an intercept is present and intercept is not NULL, the intercept is returned first, followed by the remaining terms.
Details
The default intercept value, "(Intercept)", is chosen to be consistent with the intercept label
returned by functions such as stats::lm()
, stats::model.matrix()
, and similar modeling functions.