Coder Social home page Coder Social logo

Comments (5)

jgabry avatar jgabry commented on May 26, 2024

Glad you like shinyStan! And thanks for bringing up this question. I haven't yet tried to deploy shinyStan to shinyapps, so I'm not sure if it's possible, but I will look into this.

A few things that will be helpful for me to know:

  • Which version of the 'maps' package do you have installed?
  • Which method did you use to install and reinstall shinyStan (e.g. the source_url method here, downloading the source code, etc.)?

More generally, there might be a few things that make it difficult to get shinyStan working on shinyapps.io, but I didn't think threejs would be the problem. threejs isn't on CRAN, but last time I checked shinyapps now works with packages from github also, so I don't know why threejs seems to be causing an error. The biggest problem I can think of (and it doesn't have anything to do with threejs) is that shinyStan doesn't work like a typical Shiny app in that the data it needs (i.e. your shinystan object, or stanfit object) isn't uploaded after the app is already running but rather passed as an argument to the launch_shinystan function. So it needs to access an object in your global environment. I would think this wouldn't be compatible with shinyapps.io.

That said, you could probably get around this by

  1. renaming your shinystan object shinystan_object and saving it as a .RData file (you can save the .RData file with any name you want as long as the actual shinystan object you're saving is named shinystan_object)
  2. putting the .RData file in the inst/shinyStan directory (i.e. the same directory as server.R and ui.R)
  3. also in the same directory put a file called global.R that just contains the line load("shinystan_object.RData").
    Then you could run shinyStan (but just with that shinystan object) like a normal shiny app (i.e. without having to use the launch_shinystan function), which might make it possible to get it working with shinyapps.io.

Anyway, I will look into whether this is actually possible and also what's going on with the threejs error. If it does end up being feasible I should probably make a tutorial for doing it.

from shinystan.

jgabry avatar jgabry commented on May 26, 2024

Ok, good news (mostly). I was able to get an example of shinyStan up on shinyapps.io here. I did have to make some changes along the lines of steps 1), 2) and 3) in my comment above and I also had to remove the parts of shinyStan that reference threejs (at least until I can figure out how to sort out that problem). There were a few other little things too.

I'll hopefully have a chance this weekend or next week to make this process easier and write up a tutorial for doing this so more people can do it, but for the time being if you want to get your app up and running here's what you can do:

  1. Take the shinystan object for the model you want to use and rename it (or rename a copy of it) shinystan_object and save it somewhere as shinystan_object.RData. So,
  shinystan_object <- your_shinystan_object
  save(shinystan_object, file = "shinystan_object.RData")
  1. Download shinyStan_for_shinyapps.zip, which I just uploaded here and unzip it.

  2. Put your shinystan_object.RData file from step 1) in the shinyStan_for_shinyapps folder.

  3. Try running shinyapps::deployApp(appDir = "shinyStan_for_shinyapps", appName = "X") and just replace X with whatever you want to call your app. You might get a warning like Paths should be to files within the project directory, but go ahead and proceed with deployment.

  4. Let me know if it works!

from shinystan.

mvuorre avatar mvuorre commented on May 26, 2024

I did the three steps as detailed in your second reply, and it works like a charm. Thanks very much! Maybe this workaround could be a function in the shinystan package?

from shinystan.

jgabry avatar jgabry commented on May 26, 2024

Great! Glad it works.

And yeah, we're working on making this easy to do. It might be in the form of a function or maybe a separate little package that's optimized for this purpose, but it will definitely become part of the intended functionality in one of the next releases.

Thanks for bringing this to my attention!

from shinystan.

jgabry avatar jgabry commented on May 26, 2024

I'm going to close this issue now and open a new one about including this in next release

from shinystan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.