Can anyone help me with my R code?

The only error that jumps to my eyes is this one, you are putting the closing quotes in the wrong place, try with this instead:

jpeg("interaction_ggplot_forgae2.jpeg", width = 1100, height = 600)

If this doesn't work, please provide a proper REPRoducible EXample (reprex) for your issue.