Gov 1005 pset 4 - subscript out of of bounds

Have you also included the library call in your Rmd file? have in mind that code run through reprex, runs on a separate clean environment, it doesn't leave anything on your current working environment.

Also, I recommend you take out the " Gov 1005 pset 4" part in your topic title since it seems like you are posting for this topic and those posts are not meant to be solved.