I would like to insert animation plot in my Shiny app published on the server. However, any try of deploying ends up in the following:
I cannot find ImageMagick with convert = 'convert'
Warning in im.convert(img.files, output = path.expand(movie.name), convert =
convert, :
Please install ImageMagick first or put its bin path into the system PATH variable
Of course, there is no problem when I run the application on my computer with installed imageMagick. So my question is how can I force Shiny server to use the imageMagick from my computer or install it in Shiny environment?
You may want to check out the magick library:
See the vignette for an example making explicit reference to using magick with gganimate:
https://cran.r-project.org/web/packages/magick/vignettes/intro.html#animation
On GitHub, There is also an example map showing successful use of magick on Shinyapps.io:
https://github.com/jeroen/shinymagick
Related
I could not find a solution to this exact problem on the web. I have R-4.2.2 and the latest vs code 1.75. Have installed all the required packages and extensions, and followed the instruction https://code.visualstudio.com/docs/languages/r, but no avail. The relevant packages and extensions I have installed are languageserver package, R extension, vscDebugger package and R debugger extension, radian package (also enabled radian in json settings, set bracketedpaste to true, point the r.rterm.windows to the radian path), httpgd package (also set "r.plot.useHttpgd": true in json settings). But everytime I ran the code using Code Runner, it outputs the plot to a file named Rplots.pdf, instead of showing it inside the vs code interface. Thanks in advance!
My R Shiny App was running fine in R-studio server. But today when I run it in R-studio server, I got an error:
Error in checkShinyVersion() : Please upgrade the 'shiny' package
to (at least) version 1.1
My app.R script has .libPaths(c('/home/jack/R/SLE_shinyApp/3.5')) in the beginning, because I intended to set up a dedicated path for this App, so that the packages won't be altered by other R scripts.
So here are all the paths; the 2nd one is the system default R library path which I have no control over.
> .libPaths()
[1] "/home/jack/R/SLE_shinyApp/3.5" "/app/x86_64/R/v3.5.0/lib64/R/library"
It turns out that htmlwidgets package, a dependency of shiny, is located only in the 2nd path and was updated by system admin since my last run, thus causing the error.
Here are my solutions and questions:
Make R search ONLY /home/jack/R/SLE_shinyApp/3.5, so I can install all needed packages and dependencies there. but how to make R search ONLY that path in app.R?
Update the shiny package in /home/jack/R/SLE_shinyApp/3.5. But if I run app.R line by line, it uses the shiny v1.1 in /home/jack/R/SLE_shinyApp/3.5 and runs OK. But if I run app.R by clicking "Run App" button, it uses the old shiny in the 2nd path and still gives the error, even with library(shiny, lib.loc = .libPaths()[1]) following .libPaths(c('/home/e0380702/R/SLE_shinyApp/3.5')).
Can anyone help?
I need to make multiple Shiny apps, exceeding my 5 app allowance in the free version of shiny.io. So I am trying to use RInno. I know this is ridiculous, but the beginner's tutorial for RInno seems too sparse for me (they do call it a 'minimal example'). I simply cannot figure out what I am meant to do. In the tutorial, a pre-loaded 'example' app is used to demonstrate.
# If you don't have development tools, install them
install.packages("devtools"); require(devtools)
# Use install_github to get RInno
devtools::install_github("ficonsulting/RInno", build_vignettes = TRUE)
# Require Package
require(RInno)
# Use RInno to get Inno Setup
RInno::install_inno()
# Example app included with RInno package
example_app(wd = getwd())
# Build an installer
create_app(app_name = "Your appname", app_dir = "app")
compile_iss()
When I run this in RStudio, a folder called app appears in my working directory. I open it to find the following (screen shot):
What do I do now? I have tried opening 'Your appname' and following the set up instructions (clicking next>next>next>>>finish). This puts a short cut called 'Your appname' on my desktop. I open this but get the error:
Am I doing something wrong? Is this a bug? Opening the html folder in the app folder from the first screen shot reveals a html of a plot that I presume is the example. This would suit me just fine for my own needs. However when I have tried to launch an existing app of my own with something like
create_app(app_name = "existing app", app_dir = "path/to/existing/app")
compile_iss()
Then I don't even get a html folder like the one in the screen shot here!
The script for my existing shiny app is in RStudio, is this right? Or does it need to be in Inno Setup Script?
Any pointers would be really great. Cheers
I'm trying to use the SemiMarkov package and I want to change one small line of code in there. I've done some digging via:
getAnywhere("semiMarkov")
& I've identified that I want to change this line:
hessian <- diag(ginv(hessian(V, solution)))
to try something like:
hessian <- diag(ginv(pracma::hessian(V, solution)))
How do I go about this? Do I need to rebuild the package from scratch, and if so do I need rTools etc for this, or is there a simple-ish workaround (I'm a relevant R novice)? I've done some searching online and can't find anything obvious. Any ideas/pointers gratefully appreciated.
If you'd like to simply test out the effect of that change in an interactive R session, you can do so using trace(). Here's how:
Type trace("semiMarkov", edit=TRUE)
In the text editor that that launches, edit the line of interest.
Save the modified file.
Close the text editor
Back in R, use the modified function.
Linux environment
Starting with downloading the package source from CRAN.
This is the landing page: https://cran.r-project.org/web/packages/SemiMarkov/index.html
This is the package source: https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
Download and extract the source:
wget https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
tar -xvzf SemiMarkov_1.4.2.tar.gz
This should result in a directory named SemiMarkov. Open up the source (cd SemiMarkov), and modify as necessary.
Next, build the changes:
cd ..
R CMD build SemiMarkov/
This will result in a new archive file named SemiMarkov_1.4.2.tar.gz.
Lastly, install your modified archive:
R CMD INSTALL SemiMarkov_1.4.2.tar.gz
Windows environment
I'm less familiar with the Windows platform. *nix tooling is available in Cygwin, but it's painful. Instead, as Josh O'Brien points out, you should follow the Windows-specific instructions in the R Installation and Administration manual.
I want to have two versions of R on my system. I want rmarkdown under shiny server to use /usr/bin/R which it does when I chmod 000 /usr/local/bin/R. Otherwise, I get an error. I do not want trouble with the error right now, nor do I want to remove /usr/local/bin/R. Can someone tell me how to correctly configure a PATH or environment component so that shiny server uses the R binary that I desire (usr/bin/R)?
In Shiny Server Pro, there's a configuration option for this: http://rstudio.github.io/shiny-server/latest/#r_path
In the Open Source version, you may just need to resort to adjusting PATH.