Using an updated variable inside renderUI - r

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.

Related

R Shiny - Putting a Reactive Function into a Data Frame

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.

R shiny rhandsontable tagging with multi-value select boxes

I'd like to implement the possibility to use in a cell a multivalue select list, such as is usually happening in tagging.
This is possible in different datatable packages in other languages, but I am sadly failing to find a solution for this in R Shiny.
I'd like to stick with rhandsontable as for my use case the multicell copy paste functionality is just too important to get rid of it, but if this is completely impossible and there are good alternatives out there that I didn't find, please feel free to suggest them.
For a reference of a similar behaviour you can see what is happening here:
https://select2.org/tagging#tagging-with-multi-value-select-boxes
this is the first result I got googling it, I can find the same for most of the other packages I tried in the past (not in R, unfortunatley I am so new to R).
Have you have ever seen a functionality like this implemented with Rhandsontable? Is it even possible to do it?

How to make a package set up protected variables in R?

I am trying to create a R package mypckg with a function createShinyApp. The latter function should create a directory structure ready to use as shiny app at some location. In this newly created shiny app, I have some variables, which should be accessed from within the shiny app, but not by the user directly (to prevent a user from accidentally overwriting them). The reason for these variables to exist (I know one should not use global variables) is that the shiny app is treating a text corpus and I want to avoid passing (and hence copying) it between the many functions because this could lead to exhaustion of the memory. Somebody using mypckg should be able to set these variables and later use createShinyApp.
My ideas so far are:
I make mypckg::createShinyApp save the protected variables in a protectedVariables.rds file and get the shinyApp to load the variables from this file into a new environment. I am not very experienced with environments so I could not get this to work properly yet because the creation of a new environment is not working upon running a shiny app so far.
I make mypckg::createShinyApp save the protected variables in a protectedVariables.rds file and get the shinyApp to load the variables from this file into the options. Thereafter I would access the variables and set the variables with options() and getOption.
What are the advantages and disadvantages of these ideas and are there yet simpler and more elegant ways of achieving my goal?
It's a little bit difficult to understand the situation without seeing a concrete example of the kind of variable and context you're using it in, but I'll try to answer.
First of all: In R, it's very very difficult to achieve 100% protection of a variable. Even in shiny, the authors of shiny tried putting up a lot of mechanisms to disallow some variables from getting overwritten by users (like the input variable for example), and while it does make it much harder, you should know that it's impossible, or at least extremely difficult, to actually block all ways of changing a variable.
With that disclaimer out of the way, I assume that you'd be happy with something that prevents people from accidentally overwriting the variable, but if they go purposely out of their way to do it, then so be it. In that case, you can certainly read the variables from an RDS file like you suggest (with the caveat that the user can of course overwrite that file). You can also use a global package-level variable -- usually talking about global variables is bad, but in the context of a package it's a very common thing to do.
For example, you can define in a globals.R file in your package:
.mypkgenv <- new.env(parent = emptyenv())
.mypkgenv$var1 <- "some variable"
.mypkgenv$var2 <- "some other variable"
And the shiny app can access these using
mypckg:::.mypkgenv$var1
This is just one way, there are other ways too

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

Is it possible to create a table with a multi-level row using ASP.NET GridView or other control

I'm not sure if I'm using the correct terminology to describe my questions so I created a few mock ups to try to show what I am trying to do.
I have an existing table listing order detail information that looks something like this:
I have some additional attributes I want to add columns for, but I would like it to appear on a separate line as part of the same row sort of like this:
The reason I want to add these columns but have them appear on the second line of each row is that I want to display more data in each row but I don't want to make the row/page wider.
I did some googling for this problem, but I'm not even sure what the standard name for this type of display is so I wasn't able to come up with anything. The closest I found was [this code project link](http://www.codeproject.com/KB/webforms/MasterDetail.aspx
) which is close to, but not the same thing I am trying to do.
Not sure what to call it either (multiline gridview?) but it should be possible. I would suggest looking at making a grid with a template column and a formview inside the template. In the rowdatabound event of the grid you write code to bind your form to the row's data. I have used this technique before on nested grids, it should work with other controls as well. Might be simpler ways to do it too, not something I have had a need to work out before.
EDIT:
I just saw a similar question where someone provided a link to this article. Not quite what we were talking about here, but very similar. Thought I would include it here as well for future reference. To bad it was written 5 months after this question was asked...

Resources