How to include renderPrint () along with other rendering in one panel
I have the following Shiny-Rmarkdown application:
---
title: "My First Shiny"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(d3heatmap)
library(ggplot2)
```
Rows {data-height=800}
-----------------------------------------------------------------------
### Plot1
Here is the attempt
```{r}
# x <- datasets::iris[,-5] # [c(2:4,7),1:4]
checkboxInput("cluster", "Apply clustering")
renderD3heatmap(
d3heatmap(mtcars,
dendrogram = if (input$cluster) "both" else "none",
scale="none",
xaxis_height = 170,
yaxis_width = 170,
height=200,
cexRow = 1.0,
cexCol = 1.0,
k_row = 6,
k_col = 6
)
)
renderPrint({tibble::as.tibble(mtcars)})
```
***
Some commentary about Frame 2.
### Plot2
It creates the following application:
Note that although I have this line:
renderPrint({tibble::as.tibble(mtcars)})
It does not appear at the bottom of the panel Plot1
. What is the correct way to do this?
source to share
renderD3heatmap
doesn't have outputArgs
which is used renderPlot
to pass arguments to width
and height
in plotOutput
, so I think you can't do that.
Instead, you can use orientation: columns
and create 2 columns, which you then split:
---
title: "My First Shiny"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(d3heatmap)
library(ggplot2)
```
Column
-----------------------------------------------------------------------
### Plot1
Here is the attempt
```{r}
checkboxInput("cluster", "Apply clustering")
renderD3heatmap(
d3heatmap(mtcars,
dendrogram = if (input$cluster) "both" else "none",
scale="none",
xaxis_height = 170,
yaxis_width = 170,
height=200,
cexRow = 1.0,
cexCol = 1.0,
k_row = 6,
k_col = 6
))
```
### Data
```{r}
renderPrint({tibble::as_tibble(mtcars)})
```
***
Some commentary about Frame 2.
Column
-----------------------------------------------------------------------
### Plot2
source to share