The data is split into strata according to the levels of the grouping factors and individual lm fits are obtained for each stratum.
lm_by(data., formula., id =NULL,...)lmBy(formula., data., id =NULL,...)
Arguments
data.: A dataframe
formula.: A linear model formula object of the form y ~ x1 + ... + xn | g1 + ... + gm. In the formula object, y represents the response, x1, ..., xn the covariates, and the grouping factors specifying the partitioning of the data according to which different lm fits should be performed.
id: A formula describing variables from data which are to be available also in the output.