This feels like it should be really straightforward, but I can't work out how to include the code used to create a plot in an R Notebook (i.e. above the plot it creates). Confusingly, some online examples (eg the one immediately below, from here) show the plot code being included automatically in the html_notebook
output, but other sources (eg the bottom image, from here show the code for the plot being hidden (which is the behaviour I am getting at the moment). I am aware that the bottom example is a html_document
output and not a html_notebook
and that there are differences between the two, but in any case I am using a html_notebook
but seeing the behaviour in the second image.
I have tried the different chunk options listed here and here (eg echo=TRUE
) but to no avail, so any help would be greatly appreciated.