Comments (11)
should be a reasonably straightforward fix - give me about 30 minutes and I should have a pull request in with the necessary fixes (adding explicit calls to ggplot for all the theme elements)
from shinystan.
Hi Andy,
Do you have the code for your package on github or somewhere I can take a
look? Maybe we can find a way around this issue.
That said, while it's always nice to depend on as few packages as possible,
would depending on ggplot2 cause any issues for your package?
Jonah
P.S. It's cool you're using shinystan as part of your package!
On Wednesday, August 12, 2015, Andy Yao [email protected] wrote:
I am developing a package which has one function that calls shinystan to
visualize/diagnose my MCMC sampling. The specific function call would be:library(my_package)
assuming this.df is in the correct dimensions
shinystan::launch_shinystan(shinystan::as.shinystan(this.df)
And then I get this error:
Loading...
Note: for large models ShinyStan may take a few moments to launch.
Loading required package: shinyListening on http://127.0.0.1:6658
Error in ggplot2::theme(...) : could not find function "element_blank"
Error in ggplot2::theme(...) : could not find function "element_blank"It seems like ggplot2 was not loaded, because library(shinystan) or
library(ggplot2) fixes this problem. I understand that I only imported 2
functions from shinystan, and ggplot2 would still need to be libraried
somewhere in my code. Is there anyway around this without having to depend
on shinystan or ggplot2?—
Reply to this email directly or view it on GitHub
#82.
from shinystan.
hmm @jgabry so it looks like the (bigger) issue is that with the Depends
on ggplot, (most) all the internal code written for shinystan doesn't explicitly call ggplot in front of every element, eg ggplot2::element_blank()
. Makes it easier to type, however if any package wants to call a single function without actually loading shinystan I don't believe it will force ggplot/shiny to load
from shinystan.
Yeah I had it this way because in one of the older iterations there was a
problem that required explicitly depending on ggplot2. But that problem was
sorted out a while ago so it could probably just be in imports instead of
depends now, and the functions could all be called with the ggplot2::,
which would be unfortunate for the source code but would solve this type of
problem.
On Wednesday, August 12, 2015, Devin Pastoor [email protected]
wrote:
hmm @jgabry https://github.com/jgabry so it looks like the (bigger)
issue is that with the Depends on ggplot, (most) all the internal code
written for shinystan doesn't explicitly call ggplot in front of every
element, eg ggplot2::element_blank(). Makes it easier to type, however if
any package wants to call a single function without actually loading
shinystan I don't believe it will force ggplot/shiny to load—
Reply to this email directly or view it on GitHub
#82 (comment).
from shinystan.
Hi Jonah and Devin!
Thank you so much for such a prompt reply! My package is on github and you could access it by:
install_github("andyyao95/walkr")
library(walkr)
A <- matrix(1, ncol = 3)
b <- 1
answer <- walkr(A = A, b = b, points = 1000, chains = 5, ret.format = "list")
## this line calls shinystan
explore_walkr(answer)
All of the code is on my github! Again, I really appreciate your help!!
Edit: depending on ggplot2 is surely not a problem for me, since it is so widely used. I was just thinking/wondering that I probably shouldn't need to do that since I don't directly use ggplot2.
from shinystan.
andy,
a quick and dirty fix would be to do
if(!any(grepl("package:ggplot2", search()))) {
message("loading ggplot2 for shinystan visualizations")
library(ggplot2, quiet =TRUE)
}
which will load ggplot if it hasn't already been loaded. Ultimately I think you'll be better off
just loading all of shinystan rather than just importing those functions, else I think you might end up picking up a lot of bugs from either ggplot or shiny functions not being available.
from shinystan.
Hi Devin,
Wonderful! I'll use that quick and dirty fix for now. I'll be following shinystan updates closely. If you guys update the structure of the depends/imports field I'll try it out and let you guys know. Either way, I could just use this fix or depend on ggplot2. Thanks again.
Andy
from shinystan.
@andyyao95 sounds good - you might need to do that same hack for shiny and/or shinystan as well (you'll find out if it keeps crashing). So if you get any more bugs/crashes just post them here and we can track down the dependency code to make it explicit as we go.
from shinystan.
@andyyao95 If you install shinystan from this branch does your function work without having to do library(ggplot2)?
from shinystan.
Hi Jonah,
This version works perfectly fine. Thank you for solving this issue!!
Andy
from shinystan.
@andyyao95 great! For now these changes are just on the separate branch but
unless we find a better way or any problems with this we'll get it into the
next release too when that's ready.
On Thursday, August 13, 2015, Andy Yao [email protected] wrote:
@jgabry https://github.com/jgabry
Hi Jonah,
This version works perfectly fine. Thank you for solving this issue!!
Andy
—
Reply to this email directly or view it on GitHub
#82 (comment).
from shinystan.
Related Issues (20)
- use posterior package for handling draws HOT 2
- Check for R version 4.0 HOT 1
- selectizeInput for estimates statistics instead of checkboxGroupInput HOT 1
- Default for "max_treedepth"/"max_td" (11) incorrect? HOT 4
- Add support for CmdStanR objects HOT 3
- diagnostics page doesn't load if `stan_used=FALSE`? HOT 1
- Suppress messages when packages are loaded
- how to raise limit above 1000 parameters? HOT 3
- Shiny stan do not work in ubuntu (tested in ubuntu 20.04 and 16.04 both LTS versions)
- variables missing from drop-down HOT 5
- Problem with LaTeX table: ErrorL subscription out of bounds HOT 6
- Latex for graphs like stan_ac, stan_dens, and others HOT 3
- Rocker script?
- Problem with missing themes HOT 13
- Flickering when selecting parameters on page "ESTIMATE"
- gtools is orphaned - Consider a replacement?
- Issue when launching shinystan demo
- launch_shinystan error message
- toggle view for `exp(param)' ?
- Running ‘testthat.R’/opt/local/Library/Frameworks/R.framework/Resources/bin/BATCH: line 60: 98584 Bus error HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shinystan.