Nb.html file generated by R notebook does not include graphs


I opened RStudio and created R Notebook. It contained the default content automatically generated and contained one graph obtained from plot(cars). Then I clicked Knit to HTML.

The yml changed from

title: "R Notebook"
output: html_notebook


title: "R Notebook"
    df_print: paged

In the folder where the code was located, two files were generated, .html and .nb.html.
.html contained the plot, but .nb.html does not contain the plot.

I pasted the <img src="data:image/ from the source code of .nb.html to an empty html file. The graph appeared.

Could anyone know why this happened and how to show graphs in .nb.html? Thank you.

RStudio Notebook preview and output file do not show code output

I find the answer. All plots should be executed manually in RStudio first, then knitted to HTML.