Need help for friend's class assignment, neither of us know R very well so I came here for help

The error message is self explanatory, there is no object called lmod so something must have went wrong on the previous step where you create that object.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.