Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust the size of an embedded Shiny App within Rmarkdown document

I have a shiny app hosted on shinyapps.io. I embed this in a html RMarkdown document using:

 ```{r}
knitr::include_app("shiny app web address")
```

This works and I successfully see the embedded shiny app, but I cannot adjust the width. include_app() has an option to adjust height, but I cannot find an option to adjust the width of the imframe.

I have tried this:

```{r}
knitr::opts_chunk$set(fig.width=16, fig.height=8)
knitr::include_app("shiny app web address")
```

But the width and height of the app do not adjust.

Does anyone have any ideas on how to adjust the width of this embedded app?

Thanks for the help.

Edit: I have also tried this: {r fig.width=16, fig.height=8}with no luck. Any ideas?

like image 252
Jorge Avatar asked Dec 12 '17 01:12

Jorge


People also ask

How do I embed a shiny app in rmarkdown?

There are two ways to do this: Defining the application inline using the shinyApp() function; or. Referring to an external application directory using the shinyAppDir() function.

How do I change the output size in R markdown?

To change the output size you can use the corresponding LaTeX commands, set just before the code junk. The smallest option would be \tiny . For a full overview consider e.g. this. After the code junk it's important to set back to the size you used before, e.g. \normalsize .

What is knitr rmarkdown?

RMarkdown is an extension to markdown which includes the ability to embed code chunks and several other extensions useful for writing technical reports. The rmarkdown package extends the knitr package to, in one step, allow conversion between an RMarkdown file (.Rmd) into PDF, HTML, word document, amongst others.


1 Answers

I would just insert it as an iframe in html as in:

---
title: "Untitled"
author: "Ian Wesley"
date: "February 28, 2018"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


###App big

<iframe src ="https://gallery.shinyapps.io/087-crandash/" height=1000px width=1000px />

###App small

<iframe src ="https://gallery.shinyapps.io/087-crandash/" height=500px width=500px />

Which results in:

enter image description here

like image 79
Ian Wesley Avatar answered Sep 18 '22 02:09

Ian Wesley