In R, type the aggregate() call that gives the mean sales per channel from the stores frame.
In R, type the aggregate() call that gives the mean sales per channel from the stores frame.
Answer
aggregate(sales ~ channel, data = stores, FUN = mean)
Mall 30.33333, Street 37.66667 — a model with a categorical predictor: one fitted value per level. lm(sales ~ channel) reports 30.33 and the difference 7.33.