size of figure in slides created by Knitr - r

I want to add a figure in slides by creating the beamer PDF in Rstudio with Knitr from .Rmd file, how can I control the size of the figure for figure I added with the following command?
![](plot/myfigure.png)

Related

In RStudio display Images inline in Rmarkdown files?

I am new in R and getting output(images/ interactive plots) displayed by some packages in viewer pane. I would rather like them to be displayed in the ramrkdown notebook.
Here is an example, using magick::image_read() which displays image in viewer pane and not inline:
Reference link where a knitted document has produced images within the notebook using same package as I have used: https://cran.r-project.org/web/packages/magick/vignettes/intro.html
Below are the settings I am using:
Have asked similar question on keras package earlier How to make plots appear in Rmarkdown file instead of viewer pane when working with keras in Rstudio?
This is happening with some of the packages, how do I make these images/plots appear inline ?

custom ppt templated changes doesn't render rmarkdown

I am attempting to render a powerpoint presentation from rmarkdown.
I downloaded this powerpoint template and associated files from sol-eng and am able to generate the powerpoint as is.
However, if I open the template and do
view -> slide master
and adjust any of the slide master (i.e. change the background color)
close slide master -> save
I get the error "The file may be damaged or it may have been created in a pre-release version of PowerPoint." when I attempt to render the powerpoint.
I am unclear why using the template as is vs changing the background would generate an error in making the powerpoint presentation.
Any suggestions would be helpful:)
it might be that R writes binary differently than Powerpoint. Is it possible to create a ioslide or beamer slide file with the original powerpoint file instead? If you do IOSlides or beamer, the view with only need a web browser and could be a more flexible file for presentation
I used a different computer/version of powerpoint; adjusted the master slide and now it works - still unsure why I couldn't adjust with my version of powerpoint so I am guessing some versioning issue.

Figures or plots with accompanying thumbnails, like in RStudio

When I create plots within a single chunk of an R-Studio markdown file, they appear in a nice array with clickable thumbnails:
However, when I publish as an HTML file, these figures are simply displayed vertically, one after the other. Is there any way to achieve the way that it originally looks in RStudio?
Unfortunately there's no way to output what RStudio shows you, but you can do this and a lot of other HTML formatting yourself using the knitrBootstrap package.
Check out the end of this example for a clickable-thumbnail example.

slidify embeds plotly plots as images rather than as normal interactive plots

I am trying to include some plots built using plotly in slides generated from .Rmd using slidify.
The problem is that the plots are rendered as images instead of being interactive.
On the same .Rmd file if instead of using slidify to produce html slides I use knitr to produce an ordinary html pages the plotly plots are interactive.
To produce the slides (with plot images instead of desired normal itneractive plot) I am using slidify with the following commands:
slidify("a.Rmd"); browseURL("b.html")
To produce the normal html page (that correctly shows the interactive plotly plots) I am using:
rmarkdown::render("a.Rmd"); browseURL("a.html")
you can save your widget
htmlwidgets::saveWidget(as.widget(p), file = "plot.html")
then insert it in the slidify in an iframe, more info here
https://plot.ly/r/embedding-plotly-graphs-in-HTML/

How to convert R reveal.js presentation to pdf?

I made a presentation in R, using one of the reveal.js templates (using revealjs R package).
By default, its generating a html file and when opened for presentation it displays top part of the browser including bookmarks, filepath etc... I can turn off bookmarks bar but not the filepath part, I need to present this in a formal setting so exporting the presentation to pdf seems like a better option.
Does anyone know how to export it to pdf? Can I add anything in the YAML header so that the output will be pdf and not html?
Below is the sample code, it generates "test.html" file. I want to generate "test.pdf" while preserving all other properties of presentations e.g transitions, interactive plots etc...
---
title: "test"
output: revealjs::revealjs_presentation
---
## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```
## Slide with Plot
```{r, echo=FALSE}
plot(cars)
```
If a manual solution is OK for you (no automatic generation of PDFs when you knit):
Open your HTML file in the browser and add ?print-pdf to the URL, e. g.
http://index.html?print-pdf
You can then print the slides into PDF (e. g. with Ubuntu Linux + Firefox + "save to file" printing option).
you may use decktape to convert various HTML presentations to pdf
https://github.com/astefanutti/decktape
The links inside the presentation will be preserved, yet the presentation will not be interactive
If you just need to hide the browser interface while preserving interactivity, use fullscreen mode
e.g. in google chrome press F11
I know this is 3 years late, but why not just put Chrome in fullscreen view?

Resources