Error in eval(predvars, data, env) : object 'charges' not found

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. Also, please review the homework policy.

What did you have in your namespace, as shown by ls() before

rm(list = ls());

Was mydata there? Is it still there?