Make prediction for each group differently
问题 I have dataset that looks like this: Category Weekly_Date a b <chr> <date> <dbl> <dbl> 1 aa 2018-07-01 36.6 1.4 2 aa 2018-07-02 5.30 0 3 bb 2018-07-01 4.62 1.2 4 bb 2018-07-02 3.71 1.5 5 cc 2018-07-01 3.41 12 ... ... ... ... ... I fitted linear regression for each group separately: fit_linreg <- train %>% group_by(Category) %>% do(model = lm(Target ~ Unit_price + Unit_discount, data = .)) Now I have different models for each category: aa model1 bb model2 cc model3 So, I need to apply each