简体   繁体   中英

Can you show the HTML output of an rmarkdown block without knitting the whole document?

I've created a R markdown notebook, to document the results from experiments. With increasing experiments and clinical data, the time to knit the document has increased significantly.

I create quite a number of plots, knit the document and share the HTML with my colleagues. The question I have is: Is there a way to show the final plots in the way they appear in the HTML documents in RStudio without knitting the document?

It is a pain to try out different dimensions and having to knit the output again and again.. Or is trial and error the only way?

In the plots window, you can go to "Export > Save as Image"; this allows you to change the size of the plot in real time and see what it looks like. It's not quite perfect for this purpose as it shows the size of the plot in pixels, and you'll need it in inches for your Rmd, but you should be able to figure out what conversion is needed on your system. There is an Export > Save as PDF, as well, which does have the output size in inches, but doesn't allow you to resize the plot in real time, though it can "preview" a plot at a given size. Either way, you can play with the sizes of your plots this way (and know what those sizes are) without knitting the whole document.

That's the beautiful thing about R notebooks, you can run all the data analysis and wrangling in a previous R chunk, and then use the next chunk just as a visualization chunk to mess with dimensions. if you use this button it will only run the chunk NOT knit the whole document. 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM