... which begs the question... how does the my.env variable get from the myApp function into the server function?
Perhaps read [1]? [1] https://shiny.rstudio.com/articles/function.html -- Sent from my phone. Please excuse my brevity. On September 21, 2017 8:13:15 AM PDT, Thierry Onkelinx <thierry.onkel...@inbo.be> wrote: >Dear Axel, > >I've used environment for such problems. > >assign("xs", xs, envir = my.env) in the myApp function >get("xs", envir = my.env) in the server function > >Best regards, > > >ir. Thierry Onkelinx >Statisticus/ Statiscian > >Vlaamse Overheid / Government of Flanders >INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE >AND FOREST >Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance >thierry.onkel...@inbo.be >Kliniekstraat 25, B-1070 Brussel >www.inbo.be > >/////////////////////////////////////////////////////////////////////////////////////////// >To call in the statistician after the experiment is done may be no >more than asking him to perform a post-mortem examination: he may be >able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher >The plural of anecdote is not data. ~ Roger Brinner >The combination of some data and an aching desire for an answer does >not ensure that a reasonable answer can be extracted from a given body >of data. ~ John Tukey >/////////////////////////////////////////////////////////////////////////////////////////// > > >Van 14 tot en met 19 december 2017 verhuizen we uit onze vestiging in >Brussel naar het Herman Teirlinckgebouw op de site Thurn & Taxis. >Vanaf dan ben je welkom op het nieuwe adres: Havenlaan 88 bus 73, 1000 >Brussel. > >/////////////////////////////////////////////////////////////////////////////////////////// > > > >2017-09-21 15:02 GMT+02:00 Axel Urbiz <axel.ur...@gmail.com>: >> Dear List, >> >> I'm trying to add a function that calls a Shiny App in my R package. >The >> issue is that within my function, I'm creating objects that I'd like >to >> pass to the app. For instance, from the example below, I'm getting >> "Error: object >> 'xs' not found". How can I pass "xs" explicitly to shinyApp()? >> >> >> *Under R directory:* >> >> myApp <- function(x, ...) { >> require(shiny) >> >> xs <- scale(x) >> >> shiny::runApp(appDir = system.file("application", package = >> "my_package"), ...) >> >> } >> >> *Under inst/application directory a file named app.R with the >following >> content:* >> >> shinyApp( >> ui = fluidPage( >> sidebarLayout( >> sidebarPanel(sliderInput("n", "Bins", 5, 100, 20)), >> mainPanel(plotOutput("hist")) >> ) >> ), >> server = function(input, output) { >> output$hist <- renderPlot( >> hist(xs, breaks = input$n, >> col = "skyblue", border = "white") >> ) >> } >> ) >> >> Thank you, >> Axel. >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.