I am very much a newbie at r and when I run this code I get "%>%" not found, "model" not found (this is a variable in a beginners data frame called mpg), and my object I just defined is not found. I am wondering how to get my object I created to work. Overall my objective is simply to layer a scatterplot on top of another - the second being only 2 seater cars which are all corvettes. I am basically identifying and highlighting the outliers in a scatterplot of displ and hwy milage. Displ being the type of engine/engine size in litres.
Also most of the ways ive written it works in the script/ plot viewer but wont work when I try to knit it into r markdown.
mpg %>% seat2mpg<-filter(model == "corvette") ggplot(mapping = aes(x = displ, y = hwy)) + geom_point() + geom_point(seat2mpg, aes(color = "red", size = 2))
If someone could type the code in to do what im trying to do I could probably figure out where I went wrong but any help is greatly appreciated!