Ggplots are not displayed after knitring to html/word/etc.

Hi,

The forum's homework policy encourages us to not simply give you fixed code, but help you get there yourself:

In your case, I'd first see if this is an issues with RMarkdown in general, or with your code. If you create a new markdown and use the default sample that's given, can you generate the plots once you knit it? If not, there's an issue with R-studio/R, if you can, it's your code.

In your code, look at the plot1 line. If you run it as you put it above, I get an error:

Error: Don't know how to add print(plot1) to a plot

The error message pretty much gives you the fix for the issue, but I doubt this was your original issue as you wouldn't have been able to plot it locally in R with that error either. If I fix it, my R-markdown works.

One last tip: Click on the options button on the top right of your code chunk to check if you are rendering both code and output

PJ

1 Like