Side by side images are not working in r markdown - r

I am trying to place side by side images in r markdown beamer using the code below.
```{r, out.width='.49\\linewidth', fig.cap='caption', fig.show='hold', fig.align='default'}
knitr::include_graphics(c('figures/yield.png', 'figures/boxplot_yield.png'))
However, the images somehow were vertically stacked, instead of horizontally. Please see the resulted plot below. Any ideas??

When I ran your code with my own pictures, they rendered side by side, you may need to make the pictures a smaller resolution and then your code should do what you want

Related

Bookdown - Add space between side by side figures using knitr::include_graphics

The recomended way to include existing images in bookdown is using knitr::include_graphics.
For example, to put two images side by side code will be something like:
```{r myfigure fig.show='hold', fig.align='center', out.width='50%', fig.cap = ""}
fig1_path <- paste0(fig_path,"image1.png")
fig2_path <- paste0(fig_path,"image2.png")
knitr::include_graphics(c(fig1_path, fig2_path))
```
However, this produces html and latex where the images are very close each other. It would be desirable to add some space/padding/margin between to look better.
For the html case, this is easy to fix because we can add some external css to control the space. However, for the latex output i don't have any decent solution yet.
Im thinking a portable workaround could be to add an extra empty image between or add lateral space to both images, but i prefer to hear better suggestions.

R Markdown Knitting to PDF Format Question

This is a two-part question, both parts are probably simple:
Why do my comments appear between the code and the output? I'd rather it display as I type it. For instance:
Gives the output:
But I would prefer the "We have 7 classes of data..." line to go above the code in the PDF.
Using the second picture from above, why does the gray box containing the code in have a larger border above the code than below? I'd rather the top have the same size border as the bottom.
I'm assuming this is an easy setting to change but I can't figure it out.

Hold added image position in R markdown

I want to add an image in the middle of R markdown report, but when I knit it to pdf, the image appears on the top of the page, not in the intended place. Here is what I use in R markdown:
![help_dataframe_screenshot](help_dataframe_screenshot.png)
Anyone knows how to fix it? I need the image at where I insert it, not on the page top.

Flexdashboard - Scroll multiple graphs written under a single R chunk

I'm trying to create a flexdashboard with several tabs. One of them needs to include multiple graphs (~50). I produce the graphs under one single chunk within a loop (because numbers of graphs varies each time). What I get in the output is showing only some graphs without being able to scroll to see the rest of them. Scroll is totally deactivated but graphs are printed.
So far I've tried and didn't work to:
change the vertical_layout = scroll
adjust the row-height but graphs got shrunk (not readable)
download latest version of flexdashboard
include some CSS style (overflow-x: scrollbar;)
run the same in simple rmakrdown and works fine
when you put each graph in different chunk, scroll works properly but it doesn't solve my problem
Any ideas?
Thank you

Plot not filling the slide in R presentation

If I make a default R presentation in Rstudio, everything looks okay, but the plot doesn't fill the whole slide.
This is the same whether in full screen or in the browser.
The documentation says "When the only content on a slide is an image, then the image will fill all available space on the slide". And it mentions that same goes for plots.
What am I missing here? What do I need to do to have the plot fill the whole slide?
I updated my RStudio to Version 0.99.903
Use out.width="100%" in your chunk options
{r, echo=FALSE, out.width="100%"}

Resources