Hi,
Welcome to the RStudio community!
You should load the data (data2) first in the script before you run it. I can see you have it in the environment, but for things like RMarkdown for example that won't suffice. So just put in the code you used to import or create data2 before the ggplot function.
Hope this helps,
PJ