Question: filtered_data % group_by(restaurant) %>% filter(n() >= 50 & n() % ungroup() model_Q5
filtered_data <- fastfood %>% group_by(restaurant) %>% filter(n() >= 50 & n() <= 60) %>% ungroup() model_Q5 <- lm(total_fat ~ cholesterol + total_carb + vit_a + restaurant, data = filtered_data) # IdentifY the strongest standardized regression coefficient strongest_predictor_Q5 <- names(which.max(abs(coef(model_Q5, standardize = TRUE)))) Q5 <- coef(model_Q5, standardize = TRUE)[strongest_predictor_Q5] Q5 <- as.data.frame(Q5) Q5 Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
