shiny apps not running/hanging/not working - r

I have installed shiny on R and when I try to run the "default" shiny app generated in RStudio (the Old Faithful Geyser app), nothing happens. Everything just appears to hang (no "listening" message, nothing). I can wait a long time, but nothing ever happens - not even the stop button in RStudio works.
I tried running the app from R directly but there is the same problem, so it does not appear related to RStudio.
I have also tried other apps that I have written but again it is the same problem.
Any ideas? Sorry, this is really vague, but it is hard to be more precise when there is no error, nothing at all.
Here is the sessionInfo().
Thank you!
Rory
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.6.0
loaded via a namespace (and not attached):
[1] compiler_4.1.0 fastmap_1.1.0 ellipsis_0.3.2 magrittr_2.0.1 R6_2.5.0 promises_1.2.0.1 later_1.2.0
[8] htmltools_0.5.1.1 tools_4.1.0 Rcpp_1.0.6 digest_0.6.27 xtable_1.8-4 httpuv_1.6.1 lifecycle_1.0.0
[15] mime_0.11 rlang_0.4.11

I solved the problem by removing all packages and reinstalling R and R Studio (to the same versions, but anyway). This worked. I have no idea how, but at least it is a working solution.
Thanks to all who gave it some thought!

I had the same issue occur (same R version of 4.1.0 and RStudio 1.4.1717). I didn't have to quite uninstall/reinstall my setup, but a simple update.packages(ask = F) did the trick for me.

Related

packrat::resolve() keeps asking me to install Rtools while it is already installed

I discovered today the very (very) cool packrat R package to make your project reproducible.
However, when I use packrat for my project by using packrat::resolve() in Rstudio, the packages that need Rtools trigger a pop-up window asking me to install Rtools (while it is already install in "C:\rtools40"). On the other hand, Rstudio is installed in "C:\Program Files\RStudio".
I tried to build this project on an other laptop and this problem doesn't appear (Rtools is installed the same and Rstudio is installed directly in C:\RStudio).
This means that Rstudio doesn't find the rtools path on the first laptop.
Is it a common problem? Could it be linked to the Rstudio path?
For info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 bookdown_0.20 rsconnect_0.8.16 htmltools_0.5.0 tools_4.0.2 yaml_2.2.1 rmarkdown_2.5
[8] knitr_1.30 xfun_0.18 digest_0.6.27 rlang_0.4.8 evaluate_0.14
Cheers!
EDIT
It turns out that using the new alternative to packrat (renv) solves this problem.
You need to add RTools40 to your PATH. You can do this either using the UI (search for "Environmental variables" on Windows search) or using
library(devtools)
Sys.setenv(PATH = paste("C:/Rtools40/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools40/mingw_$(WIN)/bin/")

blogdown::serve_site() times out and live preview in viewer does not load

I have made a site using blogdown but never got around to deploying it. I haven't touched my site for maybe a month and half but the live preview was working at that time. I could see a preview of my site in the Viewer tab.
Today, I opened my project and blogdown initiated the live preview on startup. However, I got the following error:
ERROR: The process "2848" not found.
Error: It took more than 30 seconds to launch the server. There may be something wrong. The process has been killed. If the site needs more time to be built and launched, set options(blogdown.server.timeout) to a larger value.
I restarted R and my device. I updated R, Rstudio and all of my packages. I still get an error but the process number changes every time I open the project or run blogdown::serve_site().
I thought that maybe my site is taking too long to load because it's too large even though it only has a few posts so far. So, I tried creating a new test site using the default Hugo theme and it started up as expected with the preview. However, if I try to change the Hugo theme using install_theme() I've run into this same error message.
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 bookdown_0.21 ps_1.4.0 digest_0.6.27
[5] later_1.1.0.1 R6_2.5.0 jsonlite_1.7.1 magrittr_1.5
[9] evaluate_0.14 blogdown_0.21 rlang_0.4.8 promises_1.1.1
[13] rstudioapi_0.11 rmarkdown_2.5 tools_4.0.3 servr_0.20
[17] processx_3.4.4 httpuv_1.5.4 xfun_0.18 yaml_2.2.1
[21] compiler_4.0.3 htmltools_0.5.0 knitr_1.30
Update 10/30: Issue resolved
As suggested in the comments, I ran blogdown::build_site which gave me different errors. I fixed the first one about a bad request. I am not able to reproduce the error now but the fix was to add ignoreErrors =["error-remote-getjson"] to my config.toml file
Since you didn't provide a reproducible example, my current guess is that you run into a blogdown bug that I have fixed two weeks ago. Please try the current development version:
remotes::install_github('rstudio/blogdown')
Remember to restart R.

Error: 'glmnet_softmax' is not an exported object from 'namespace:glmnet'

I am trying to use this tutorial https://github.com/wvictor14/planet#infer-ethnicity and get the following error message, even when using the test data provided:
pl_infer_ethnicity(pl_betas)
[1] "1860 of 1860 predictors present."
Loading required package: Matrix
Error: 'glmnet_softmax' is not an exported object from 'namespace:glmnet'
I've tried re-installing individual packages and running in a new version or R and get the same error. I believe this is related to other errors posted with a recent update in glmnet. Any tips on how to resolve?
sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Matrix_1.2-18 planet_0.1.0
loaded via a namespace (and not attached):
[1] lattice_0.20-38 codetools_0.2-16 glmnet_3.0-2 foreach_1.4.7
[5] crayon_1.3.4 grid_3.6.2 magrittr_1.5 pillar_1.4.2
[9] rlang_0.4.2 remotes_2.1.0 iterators_1.0.12 tools_3.6.2
[13] compiler_3.6.2 pkgconfig_2.0.3 shape_1.4.4 tibble_2.1.3
I don't know why it would have worked in the first place; the NEWS file for glmnet doesn't say anything one way or the other about glmnet_softmax (e.g., it does not say "glmnet_softmax is no longer exported" or anything like that ...)
In any case, this is a non-exported function from the glmnet package. It is referred to here in the tutorial code.
If you can change that line of code to refer to glmnet:::glmnet_softmax (i.e., three colons rather than two), that should suffice (::: allows you to access a non-exported function).

Shiny example files don't show the proper interface

I installed the shiny package, but after running the example file: runExample("01_hello"), the pop up does not show the expected interface (for example, there's no sliding bar, and nothing happens after entering manually a number of bins). I see the same effect if I view it in an external browser as well. See the below picture for better understanding. I tried similar cases and it is always the same...
library(shiny)
runExample("01_hello")
The app that opens looks like this:
But should look like this:
I just installed the latest version of R and RStudio for Windows10 (64bit) but still have the issue... Also tried to update the graphic drivers in case the problem was with them, but no solution so far. Any hints?
Here the session info.
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.8.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 crayon_1.3.4 assertthat_0.2.1 R6_2.4.0
[5] magrittr_1.5 pillar_1.3.1 rlang_0.3.4 rstudioapi_0.10
[9] tools_3.5.3 glue_1.3.1 purrr_0.3.2 xfun_0.6
[13] compiler_3.5.3 pkgconfig_2.0.2 knitr_1.22 tidyselect_0.2.5
[17] tibble_2.1.1
Finally I think I got an answer. My R library was saved under a path that was not compatible with shiny (meaning that the path had special signs like à). I solved the problem deleting the libraries and reinstalling them in a new path C:/Program Files/R/R-3.5.3/library. For that may be needed to run R-Studio as admin.
Thanks for the help, was much appreciated :)

R looks in the wrong place for html dependency

I am trying to knit a flexdashboard to an html file. My flexdashboard includes leaflet maps. The knit.md file compiles correctly. At the last stage, converting the knit.md to an html file, I get an error. Apparently leaflet is looking for html dependencies in the R 3.3.2 folder, rather than the R 3.4.2 folder. I originally built this flexdashboard months ago on a different machine on which I had R 3.3.2 (although I was using 3.4.1 I believe to build this). So the problem appears to be that leaflet still looks in the old R-3.3.2 folder for its dependencies even though I've updated and reinstalled leaflet multiple times, trying to fix this problem.
Does anyone know how to tell leaflet to look in the correct place for its html dependencies?
output file: myflexdashboard.knit.md
Error: path for html_dependency not found: C:/R/R-3.3.2/library/leaflet/htmlwidgets/lib/leaflet-providers
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 backports_1.1.1 magrittr_1.5 rprojroot_1.2 htmltools_0.3.6
[6] tools_3.4.2 flexdashboard_0.5.1 yaml_2.1.15 Rcpp_0.12.14 stringi_1.1.6
[11] rmarkdown_1.8 knitr_1.17 jsonlite_1.5 stringr_1.2.0 digest_0.6.12
[16] packrat_0.4.8-1 evaluate_0.10.1

Resources