R Shiny - Putting a Reactive Function into a Data Frame - r

In my app, I am bringing in data and getting it to kick out to datatables for display. However, I then need that data to be available for use with tidygraph which doesn't seem to play well with reactive data. As such, I'd like to make the "reactive" static. Is there a way?
For the record, I 100% am not looking to render this as a data table for display. I already have all that functionality. Whenever I search for a response to this issue, everyone's advice seems to end with renderDT but not put the OP's data back into a workable dataframe.
In short, how do I see reactive data in a frame?
I've tried about every reactive command option there is. Nothing seems to be working.

I figured it out! I simply had to place the problematic action into the reactive, which seems logical but I didn't think it would allow me to do what I wanted. Nevertheless, I have achieved the full functionality that I wanted for this stage.
Thanks for the guidance to those who responded.

Related

Performing automated test for R shiny dashboard

Good day all,
I have spent quite some time looking into ways to perform unit test on my UI, specifically on my valuebox, progressbar, barcharts, etc. Firstly I am not exactly sure if "unit test" is the right term in this context so please kindly correct me if I am wrong. What I intend to do is to ensure that for example that the valuebox appears as intended (if I want 10 to appear on it, it should appear as 10 and not other number), the progressbar will progress accordingly to a reactive data.
I have looked into an R package called shinytest and they seem to have a snapshot approach which may not be feasible if we intend to extract data from a reactive database. I then tried out an article from R with regards to unit testing and was wondering if that is the right path for me.
Can I kindly get advice from experts that incorporate testing into their dashboard?
Thanks in advance!

How can I extract all the data from the Cancer Types Summary Page on CBioPortal at once?

I would really like to take the data that would normally be seen by hovering over each column at once. The graph is an interactive one so its hard to extract all the data at once. I would really like it.
I suggest that you pick a programming language that you know fairly well.
Then load the web pages, use a selector to select the desired elements, and output the data in the format you like.
Please begin writing the code, and update your question when you have something working at least partially, so you can ask precisely where you need help

Using an updated variable inside renderUI

I was having problems with using variables inside renderUI and after looking around, it seems like the problem is that it doesn't read a variable like normal, so I'm looking for solutions
lets say I have a variable called modelname
in the renderUI, if a radio button was selected, it will display several different pages depending on another radio button, but each one will have multiple downloadLinks.
What I would like is some way to set modelname to something for each combination, so that I can make a call to downloadHandler and use that modelname to access the right file.
Any ideas? Thanks
I would suggest that you post a code and produce a reproducible examples. Without looking at the code, I can only guess the the problem pertains to not addressing objects correctly, as you would have when following guidance in an article on scoping rules in Shiny. I would suggest that you define your variables in global.R as it usually makes Shiny apps less messy.

store dataset filtered using DataTables in Shiny in app

To perhaps save a few people a minute or two ... this question is about DataTables in a Shiny app (http://shiny.rstudio.com/articles/datatables.html) and not Data.Table
I would like to access the index of rows available in DataTables in Shiny. I do not want to save the filtered data as a csv file but, rather, add the data.frame to a dropdown of datasets the app user can work with. I am using reactive values to store data.frames and I don't expect too much trouble adding the file/data to the dropdown list once I can access the data.frame (or row index).
Although, again, I do not want to rely on tabletools or similar, to save data to disk, there are several questions related to mine (see link below). However, there must be an easier way to access the filtered data-frame in a shiny-app. If not, perhaps there should be :)
I was hoping I might be able to use renderDataTable but I am not sure how that would work.
Saving from Shiny renderDataTable
Thanks to #yihui this is now possible using the DT package and input$tableId_rows_all where tableID is the id assigned to your table. See the link below for details.
http://rstudio.github.io/DT/shiny.html

How can you visualize data frames in a good way?

Given that you have a data frame with a lot of columns and rows, how can you visualize this in a good way?
I have imported my data from excel, where I in a clear way can browse my data. However, when I import it as a data frame into R, things get more complicated. I quickly get lost in the output in my terminal window. Could I output my data frame into some form of more easily accessible form for viewing, something that looks more the way it would look in excel?
RStudio does a pretty good job with its built-in (read-only) data viewer. Other solutions ( have been suggested on Cross Validated: Is there a good browser/viewer to see an R dataset (.rda file).
You can use edit(my.data.frame).
It will open your data.frame into the default editor specified by getOption("editor"). You can use option(editor = ".......") to change that default, or just use the editor= option when calling edit. This is only relevant for Unix users.
Finally, I'll bring your attention to this important portion of the ?edit documentation:
It is important to realize that edit does not change the object called name. Instead, a copy of name is made and it is that copy which is changed. Should you want the changes to apply to the object name you must assign the result of edit to name. (Try fix if you want to make permanent changes to an object.)

Resources