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
Related
I'm using visual studio code to program in R and I have recently had trouble using the ?func and ??func command.
When typing something like ?rnorm, the message Couldn't show help for path: /library/stats/html/Normal.html shows up. The path is there and I'm sure R is in the path environment. This is really boggling me.
When I first installed R it was working absolutely fine in VSC but now it does not work. However the function works in the R shell. When I try to navigate to the R extension and click on "Help Topics by Package" it says help provider not available.
The packages/html files are there, but VSC doesn't want to access them.
Please advise what I can do to solve this.
I solved the same issue by checking my environmental variables. The steps I followed:
I added the bin installation file (C:\R\R-4.1.3\bin in my case, or C:\Program Files\R\R-4.1.3\bin) to the path in my user environmental variables. If you have an admin account, then you have to add the bin folder to the system environmental variables.
Check if you can start a R console from any terminal.
If that is positive, then in the Rpath settings for the R extension in vscode write r, or in the settings.json: "r.rpath.windows":"r"
Restart vscode. Check if the help pages are working.
Hope this helps ! Cheers.
This happened to me as well. I googled and tried different things and this works for me:
You need to provide the Rpath for the system you are using in the settings for the vscode R package. For example, for a windows machine, you need C:\Program Files\R\R-4.1.3\bin\x64\R.exe there if you installed the latest R using the default settings, and similarly for other systems.
Hope it helps!
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'm trying to make available a shiny app for some people at work but I don't want to change the working directory manually for everyone. I had plan to use the rstudioapi function getActiveDocumentContext() but it only works when the app is lunch from rstudio and i'm using R console because the app is deployed with a .bat file (describe in this page http://rstudio-pubs-static.s3.amazonaws.com/3269_a6682dfda37e411fb5e0e6699495cdc4.html). I tried a bunch of the answers here (Rscript: Determine path of the executing script) but neither work, and most of them I don't understand so I was not able to "fix theme".
As your linked SO question indicates, there are many solutions, my favorite is using rprojroot (I think it is probably the easiest). Using the simply shiny test_app example, you need to have this in your run.R:
library(shiny)
library(rprojroot)
folder_address = dirname(thisfile())
runApp(folder_address, launch.browser=TRUE)
I tested it on a Mac with the start script (test.command) below, and it works wherever you have the test_app folder:
#! /bin/bash
PWD="`dirname \"$0\"`"
cd "${PWD}"
Rscript "run.R"
On a Windows computer, you'll need to specify the path to Rscript.exe (or R.exe) in your test.bat:
"C:\Program Files\R\R-3.5.1\bin\Rscript.exe" "run.R"
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
according to:
Locally installed Shiny app
I developed a Shiny application which can be distributed as a folder with a runscript and R-portable inside.
Now I implemented an export button in the shiny app, which generates a pdf file through rmarkdown. Running the shiny app from rstudio works.
But running the app in the folder with runscript, the pdf export does not work.
I think I also need RStudio portable and miktex portable inside the folder, but I do not know how to link the render function in rmarkdown package to this RStudio and how does RStudio know where the miktex executable is?
I can not install RStudio and miktex locally on the other machines, so I have to distribute it with the Shiny app.
Thanks for helpful comments.
I found the solution for the problem.
I copied the pandoc folder from RStudio and miktex portable into the main folder of my desktop app.
Second, I wrote the following into the RProfile.site in R-Portable (RPortable/App/R-Portable/etc/RProfile.site):
Sys.setenv(PATH=paste("C:/Program Files/Java/jdk1.8.0_05/jre/bin/server",sep=";","../pandoc/","../miktex/miktex/bin/"))
Now it runs on different machines. Only the Java path has to be changed eventually on another machine.
Bests