0

I have gathered some data from different sources and now I have a big dataframe that is full of pathway names in the first column and some scores across its columns. Now I want to build an rshiny tool which allows the users to click on some of the values, like pathway names, and get a new page/tab with a dataframe that contains details about that specific pathway name clicked. I already have all the information/dataframes in my workspace but dont't know how to make an interactive rshiny tool to make it accessible for other users.

A bigger question is whether rshiny can handle this kind of a case.

Ive built rshiny tools before that uses the information from dataframes to give you interactive graphs and etc. but never done an interactive dataframe tool. Any lead would help. Thanks!

Here is an example df

df1 <- as.data.frame(matrix(c("PathwayX","10","5","3","PathwayY","30","8","6","PathwayZ","20","6","2"), ncol = 4,byrow =T))
colnames(df1) <- c("PathwayName","Score1","Score2","Score3")

pathwayX <- as.data.frame(matrix(c("OrganismA","xxx2","xxx1","xxx3","xxx6","xxx7","xxx10","xxx19","0.20","0.30",
          "OrganismB","xxx2","xxx1","xxx3","xxx6","xxx7","xxx10","xxx19","0.40","0.50"),nrow = 2, byrow = T)) 
colnames(pathwayX) <- c("OrganismName","Gene","Gene","Gene","Gene","Gene","Gene","Gene","Score1","Score2")

I want to be able click on 'PathwayX' on my rshiny table df1 and pop up a new page or tab that gives me df2. I hope this is more helpful.

Fırat Uyulur
  • 149
  • 1
  • 11
  • Look into `DT` package for tables and `?shiny::insertUI` or `?shiny::insertTab` for dynamic UI. Also a minimum working example code will help you get more specific answers. – Shree Oct 12 '18 at 13:22
  • Ive gone through this package now. at the very bottom of the [page](https://rstudio.github.io/DT/) there is a hyperlink example. Do you know how to hyperlink a dataframe in your workspace to a value, as in the example, I want to click hello and get a dataframe from my workspace? – Fırat Uyulur Oct 12 '18 at 13:51
  • I can help but only if you include a minimum working example in your question. – Shree Oct 12 '18 at 14:14

1 Answers1

0

You can create datatable from DT package and lookup for input$datatableName_rows_selected via observeEvent() and that will give you row number(s) of selected rows (but if you change selection option in datatable to 'single', you will always get one number). Next you can use showModal(modalDialog()) with data that you need (place new datatable into modal, or anything you need).

fenix_fx
  • 394
  • 2
  • 10