Dear R Community
I am trying to do the following. I have two .Rdata objects, e.g. res1.Rdata
and res2.Rdata. I want to achieve that the user can select the object of
interest within shinyapp.
I.e. in ui.R I have:
radioButtons("object", "Object",
list("res1" = 1,
"res2" = 2
)),
In server.R I have:
objectofinterest <- reactive({
as.numeric(input$object)
})
.GlobalEnv <- reactive({
load.data(objectofinterest())
})
where
load.data=function(x){
if (x==1){
load('../shinyapp/res1.Rdata', envir=.GlobalEnv)
}
if (x==2){
load('../shinyapp/res2.Rdata', envir=.GlobalEnv)
}
}
using load.data in R directly works perfectly. But when I start shinyapp,
it seems that shinyapp cannot get the objects. What am I doing wrong?
Thank you!!
Regards
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.