solution gives syntax error when copying and pasting it

I'm using code_check to check ggplot code with gradethis in a learnr tutorial. The code runs when I past the solution from the Rmd file but not when I copy it from the clipboard when running the tutorial. In the latter case there is a syntax error. Here are the code from the Rmd file and the copy from clipboard:

From Rmd:
ggplot(data=Counties, mapping=aes(x=factor(rural_urban))) +
geom_bar() +
labs(title = "Number of US Counties that Cast a Majority of \nVotes for the Major Party Presidential Candidates",
subtitle = "2016",
x=NULL,
y="Frequency",
caption="Source: Linn, Nagler, Zilinsky")

From clipboard:
ggplot(data=Counties, mapping=aes(x=factor(rural_urban))) +
geom_bar() +
labs(title = "Number of US Counties that Cast a Majority of \nVotes for the Major Party Presidential Candidates",
subtitle = "2016",
x=NULL,
y="Frequency",
caption="Source: Linn, Nagler, Zilinsky")


Referred here by gradethis's README

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.