2017-06-28 1 views
3

Ich habe folgende Shiny-Rmarkdown App gehören:Wie renderPrint() zusammen mit anderen Rendering in einem Panel

--- 
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 

Es produziert die folgende App:

enter image description here

Beachten Sie, dass obwohl Ich habe diese Zeile:

renderPrint({tibble::as.tibble(mtcars)}) 

Es zeigt nicht ein t der Boden von Plot1 Panel. Was ist der richtige Weg?

Antwort

0

renderD3heatmap hat outputArgs nicht die von renderPlot verwendet wird width und height Argumente plotOutput passieren, also denke ich nicht wirklich, dass es so machen kann.

Stattdessen möchten Sie vielleicht orientation: columns verwenden und 2 Spalten erstellen, die Sie dann aufgeteilt:

--- 
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 

enter image description here

+0

Aber ich will es mit 'Plot1' in derselben Platte sein. Nicht möglich? – neversaint

Verwandte Themen