[R] r-markdown - keeping figures

John Kane jrkrideau at inbox.com
Wed Oct 21 13:16:56 CEST 2015


It may not be elegant but you can just embed a png() command in the knitr code.  Code from RStudio example with png() command added.


```{r, echo=FALSE}
plot(cars)
png("~/Rjunk/pnd.png")
plot(cars)
dev.off()
```

John Kane
Kingston ON Canada


> -----Original Message-----
> From: wewolski at gmail.com
> Sent: Tue, 20 Oct 2015 18:18:04 +0200
> To: r-help at r-project.org
> Subject: [R] r-markdown - keeping figures
> 
> I am running r-markdown from r-studio and can't work out how to keep
> the figures.
> I mean I have a few figures in the document and would like to have
> them as separate pdf's too as I have been used to have them when using
> Sweave.
> 
> 
> 
> best regards
> Witold
> 
> 
> --
> Witold Eryk Wolski
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list