how do i remove the error?

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.

After a while, we take it for granted, but the idea of namespace is quite important in R. Line 22 tries to assign to a new object, r1, the value of an lm function that was given the argument data = cps12.

If at this point, you switch to the console and enter

ls()

you will see no object of that name and it probably doesn't exist in the background, either, like some of the always-on objects such as mtcars.

If you fiddle around, you'll see that there's an option to run all chunks above this one; if cps12 has been created above, that will run the chunk without the same error.