INWTlab / shinyMatrix

https://inwtlab.github.io/shinyMatrix/
Other
19 stars 6 forks source link

Usage in flexdashboard and runtime shiny #9

Closed dirkdegel closed 4 years ago

dirkdegel commented 4 years ago

Hi all, I'm totally new to this package and it is something I was looking for for a while.

I found this article: https://www.r-bloggers.com/shinymatrix-matrix-input-for-shiny-apps/ and used the code to build the app.R file and it worked perfectly fine.

Usually I use flexdashboards with the shiny runtime. I tried to use the same code but was not able to get it running. Please find a minimal example below.

Any help is much appreciated.

Thanks Dirk

---
title: "shinyMatrix Package"
output: 
  flexdashboard::flex_dashboard:
runtime: shiny
---

```{r global, include = FALSE}

library(shinyMatrix) # https://github.com/INWTlab/shiny-matrix

Sidebar {.sidebar}

Matrix


m <- matrix(runif(12), 6, 2, dimnames = list(NULL, c("x", "y")))

matrixInput(
  inputId = "sample", 
  value = m,
  #inputClass = matrix-input,
  rows = list(extend = TRUE), 
  cols = list(names = TRUE),
  class = "numeric",
  paste = TRUE,
  copy = TRUE
)

Matrix

Column

Display Plot


renderPlot({
  plot(input$sample, col = "red", main = "Scatterplot")
})
Ljupch0 commented 4 years ago

Flexdashboard + runtime shiny has been very buggy in my experience. Try replicating in a regular shiny app?

aneudecker commented 4 years ago

Hi @dirkdegel

thanks for reporting this. I am not sure how flexdashboard includes the javascript and css files. Could you post the page source from the flexdashboard page to see if the shiny-matrix dependencies are included at all?

amitghosh-inwt commented 4 years ago

I also tried to reproduce this. The <div> section created by shinyMatrix is actually included in the output of your flexdashboard (you can see it, when using the "Inspect element"). However it's not properly displayed in the HTML. It seems indeed, that shinyMatrix and flexdashboard are not compatible. It will require modifications in one of the two packages to make it work.

aneudecker commented 4 years ago

I am closing this because it seems like a flexdashboard issue.