I’m trying to plot the original date with the predictions of the best models using curve() because I’m working with polynomial models, but I keep getting this error:
Error in curve(predict(best_models[[i]]$best_model, newdata = data.frame(get(normalized_columns[i]))), :
‘expr’ must be a function, or a call or an expression containing ‘x
This is the part of the code that it is generating the error:
par(mfrow = c(2, 3)) for (i in 1:6) { curve(predict(best_models[[i]]$best_model, newdata = data.frame(get(normalized_columns[i]))), from = min(filtered_resp_data[[normalized_columns[i]]]), to = max(filtered_resp_data[[normalized_columns[i]]]), col = "blue", lwd = 2, xlab = normalized_columns[i], ylab = "xxx", main = paste("Real Data vs. Best Model (Degree", best_models[[i]]$best_degree, ")"))