Shiny example files don't show the proper interface - r

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 :)

Related

gdalcubes create_image_collection() results in R session Abort after interrupting it

I want to use gdalcubes in order to create a datacube structure in R from locally safe remote sensing data time series. I have tried it on a big data set (~5GB) and the create_image_collection function started, but the process was very slow (11% after three hours) and I couldn't barely use my computer while it was runinng. Therefore, I interrupted the process in a very brutal way (holding power button).
This seems to have been a big mistake, because now the function always result in a 'R Session Abort', even when calling it on a much smaller dataset. I unistalled gdalcubes and reinstalled it, but nothing has changed.
Are there any files I could delete or directories to reset in order to make it work again? I fear there are some files left anywhere in the directory structure that may cause this, but I really don't have no idea of these structures.
Thanks for any help, I really need this package!
See question on GitHub: https://github.com/appelmar/gdalcubes_R/issues/78
> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C LC_TIME=German_Germany.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RPostgres_1.4.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 rstudioapi_0.14 raster_3.6-14 knitr_1.41 hms_1.1.2 rappdirs_0.3.3 bit_4.0.5 here_1.0.1 lattice_0.20-45 rlang_1.0.6
[11] fastmap_1.1.0 blob_1.2.3 tools_4.2.2 grid_4.2.2 xfun_0.36 png_0.1-8 terra_1.6-53 cli_3.4.1 DBI_1.1.3 htmltools_0.5.4
[21] ellipsis_0.3.2 yaml_2.3.6 digest_0.6.31 bit64_4.0.5 rprojroot_2.0.3 lifecycle_1.0.3 Matrix_1.5-1 codetools_0.2-18 vctrs_0.5.1 evaluate_0.20
[31] rmarkdown_2.20 sp_1.5-1 compiler_4.2.2 reticulate_1.26 jsonlite_1.8.4 pkgconfig_2.0.3
after a lot of research and trying around, the simple solution was to install R 4.1.0. In this version of R the package is working perfectly. R session Abort can often be solved by this, probably.

shiny apps not running/hanging/not working

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.

save_kable does not work after installing R v4.0.2

I have successfully used save_kable() from kableExtra to export latex tables into *.png before. However, after updating R to the version 4.0.2, save_kable always ends with R fatal error (no specific error message is shown, the session is just aborted). I installed a clean version o R 3.6.3 and everything works fine again.
Next, I re-installed MikTEX, but this does not seem to be the problem because R Markdown can knit a .pdf file without an issue (in the 4.0.2 version). Also, using save_kable with "html" options works fine and exports the table into .png. The problem seems to be specific for latex.
Looking at sessionInfo(), the only difference is that R 3.6.3 automatically loads the 'magick' package, while R 4.0.2 does not. However, loading the magick package manually in the latter R version does not solve the problem. Then, of course, the sessions differ in the "compiler" package versions. Maybe this is the source of the problem?
Any help would be much appreciated. The problem can be reproduced with minimal code such as
kable(mtcars, "latex") %>% save_kable("test.png")
Here is the sessionInfo
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 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] magick_2.4.0 kableExtra_1.1.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.11 knitr_1.29 xml2_1.3.2 magrittr_1.5
[6] hms_0.5.3 rvest_0.3.5 munsell_0.5.0 viridisLite_0.3.0 colorspace_1.4-1
[11] R6_2.4.1 rlang_0.4.7 stringr_1.4.0 httr_1.4.1 tools_4.0.2
[16] webshot_0.5.2 xfun_0.15 htmltools_0.5.0 ellipsis_0.3.1 digest_0.6.25
[21] tibble_3.0.3 lifecycle_0.2.0 crayon_1.3.4 readr_1.3.1 vctrs_0.3.2
[26] glue_1.4.1 evaluate_0.14 rmarkdown_2.3 stringi_1.4.6 compiler_4.0.2
[31] pillar_1.4.6 scales_1.1.1 pkgconfig_2.0.3
This seems to be a windows specific problem. I actually just asked a recent question here
kableExtra HTML styling in Rmarkdown and kable_save()
Some of the things I have seen mentioned as potential fixes are listed there such as updating ghostscript, not using tinytext, updating some latex packages including 'standalone', and editing the policy.xls document in ImageMagick ImageMagick security policy 'PDF' blocking conversion.
None of these worked for me and I get the same crashing issues the second I try to kable_save a latex format into png. However, some other Windows users have found success with the steps above so maybe try that out and see how it goes.

Error in as.POSIXlt.POSIXct(x, tz) : (converted from warning) unknown timezone 'GMT'

I find myself confronted with a problem for which I fail to find a clue to a solution - which makes it very hard to actually deal with it.. Here goes: In R (with R-Studio) I try to create a Date object with the library lubridate:
library(lubridate)
ymd(20161001)
which results in an error:
Error in as.POSIXlt.POSIXct(x, tz) :
(converted from warning) unknown timezone 'GMT'
A second run (and any subsequent runs) of the last command yields the correct result:
ymd(20161001)
[1] "2016-01-01"
until I restart my R-session, when again the first run triggers an error. I've checked several settings, but can't find anything changing from the first to the second run. Here's, for instance, the output of my sessionInfo():
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.6.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.3.2 stringi_1.1.2 stringr_1.1.0
Sys.timezone() says [1] "Europe/Berlin", and Sys.getenv('TZ') is empty: ""
I do find others stumbling upon the same warning, such as this blogpost or here, but these problems have to do with times, whereas I would prefer to ignore times altogether, and deal with dates only.
I was getting the same error today. My code was in an Rmarkdown file set to output as a tufte_html document. I was loading the following packages:
library(lubridate)
library(tidyverse)
library(stringr)
library(extrafont)
library(extrafontdb)
library(tufte)
To get my code working I did the following:
First, I got off my company's VPN, suspecting that maybe it was the problem, but I was still getting the error when using my home wifi and no VPN. Next, I updated all my packages but was still getting the error.
Then, I shut down my Macbook and rebooted but was still getting the error.
Finally, I changed my script to no longer load tidyverse as a whole but instead load:
library(lubridate)
library(tibble)
library(dplyr)
library(readr)
library(extrafont)
library(extrafontdb)
library(tufte)
Then my Rmarkdown file rendered to html without the unknown timezone error. Unfortunately, I cannot pinpoint what exactly fixed the error or why loading parts but not the whole tidyverse seemed to do the trick for me. Did you ever solve your problem?
My session info when it worked:
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tufte_0.2 extrafontdb_1.0 extrafont_0.17 stringr_1.2.0
[5] readr_1.1.1 dplyr_0.7.4 tibble_1.3.4 lubridate_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 Rttf2pt1_1.3.4 knitr_1.17 bindr_0.1
[5] magrittr_1.5 hms_0.3 R6_2.2.2 rlang_0.1.4
[9] tools_3.4.2 htmltools_0.3.6 yaml_2.1.14 rprojroot_1.2
[13] digest_0.6.12 assertthat_0.2.0 bindrcpp_0.2 glue_1.2.0
[17] evaluate_0.10.1 rmarkdown_1.8 stringi_1.1.6 compiler_3.4.2
[21] backports_1.1.1 pkgconfig_2.0.1
The answer to this question worked for me.
I added Sys.setenv(TZ='America/Detroit') to my script, for example.
The solution presented here R error: unknown timezone with as.POSIXct()
In my case, after including Sys.setenv(TZ="America/Lima") at the beginning of the code everything works fine.
Please check the list of valid TZ values at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Ctrl + Shift + D doesn't run documentation routines

According to the shortcuts help (Alt+Shift+K) the combination Ctrl+Shift+D should run the documentation routines. (This is also said in Section 5.1 of Hadley Wickhams "R packages" http://runsheng.github.io/attachment/r-packages.pdf.) But in my RStudio-setting, it doublicates the selected row (so I don't belive it is a global usage problem brought up in the answers here: Visual Studio won't recognize key combination). On https://support.rstudio.com/hc/en-us/community/posts/201819358-Ctrl-Shift-D-doesn-t-run-document-in-preview-release the issue was brought up by someone, but without a solution. How can I make RStudio do what it should do?
I'm using RStudio version 0.99.902 and sessionInfo() gives:
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
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] hmi_0.1.0 roxygen2_5.0.1 coda_0.18-1 MASS_7.3-45 devtools_1.12.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.3.1 withr_1.0.2 rstudioapi_0.6 Rcpp_0.12.5
[6] memoise_1.0.0 stringi_1.1.1 grid_3.3.1 stringr_1.0.0 digest_0.6.9
[11] lattice_0.20-33
Can you double check what these options are set to in Project Options?
You might need to ensure that both
Use devtools package functions in available
Generate documentation with Roxygen
are both checked.

Resources