R Shinyapp works locally but not on Shinyapp.io server - r

I am trying to make a shinyapp which let users upload a certain format of file. After uploading the file, the shinyapp will automatically plot some table and charts using dplyr and rCharts.
It works well when I run it locally using “Run App”. However, when I publish to shinyapp.io, I got this error:
path1="": No such file or directory
After searching on the internet, I haven’t found any solution to solve this problem. Could anyone help me on what the possible reason causing this issue?
Here is my code and my sessionInfo().(It's a little bit long and messy)
https://github.com/johnnychiuchiu/Cheetah_ShinyApp/blob/master/server.r
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)
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
[7] base
other attached packages:
[1] stringr_1.0.0 dplyr_0.4.2 rCharts_0.4.5 shiny_0.12.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.1 lattice_0.20-33 assertthat_0.1
[4] digest_0.6.8 mime_0.3 grid_3.2.2
[7] plyr_1.8.3 R6_2.1.0 DBI_0.3.1
[10] xtable_1.7-4 jsonlite_0.9.16 magrittr_1.5
[13] stringi_0.5-5 lazyeval_0.1.10 rstudioapi_0.3.1
[16] whisker_0.3-2 RJSONIO_1.3-0 tools_3.2.2
[19] parallel_3.2.2 httpuv_1.3.3 yaml_2.1.13
[22] rsconnect_0.4.1.4 htmltools_0.2.6

The "h" in "Highcharts" needs to be lowercase, e.g.:
showOutput("h5", "highcharts"),
If that doesn't work: For the deployment, showOutput needs you to detail the path to your rcharts-lilbrary (at least in my case, for whatever reason ^^).
I had a problem which was very similar to yours. Here's my solution:
"ERROR: path[1]="": No such file or directory" when publishing Parallel Coordinates Chart with Shiny

Related

Error in loading package SASxport: object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'

I'm trying to read data in the XPT format into R (the format can be found for example in the NHANES data). I found two functions doing this:
library("Hmisc")
sasxport.get("C:/path/file.XPT")
and
library("SASxport")
read.xport("C:/path/file.XPT")
The sasxport.get works, so I'm basically fine, but still inquisitive enough to understand (and solve) the following error: after the installation of the SASxport package, I cannot load it. When I run library("SASxport"), I get the error message:
Error: package or namespace load failed for ‘SASxport’:
object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'
Adopting this suggestion, I also ran
remove.packages(c("SASxport", "Hmisc"))
install.packages('Hmisc', dependencies = TRUE)
install.packages('SASxport', dependencies = TRUE)
what did not change the error message.
This is my sessionInfo():
R version 3.4.3 (2017-11-30)
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 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Hmisc_4.1-1 ggplot2_2.2.1 Formula_1.2-2 survival_2.41-3 lattice_0.20-35
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 pillar_1.0.1 compiler_3.4.3 RColorBrewer_1.1-2 plyr_1.8.4
[6] base64enc_0.1-3 iterators_1.0.9 tools_3.4.3 rpart_4.1-11 digest_0.6.13
[11] tibble_1.4.1 gtable_0.2.0 htmlTable_1.11.1 checkmate_1.8.5 rlang_0.1.6
[16] icenReg_2.0.7 Matrix_1.2-12 foreach_1.4.4 rstudioapi_0.7 yaml_2.1.16
[21] gridExtra_2.3 coda_0.19-1 stringr_1.2.0 cluster_2.0.6 knitr_1.18
[26] htmlwidgets_0.9 grid_3.4.3 nnet_7.3-12 data.table_1.10.4-3 foreign_0.8-69
[31] latticeExtra_0.6-28 magrittr_1.5 scales_0.5.0 backports_1.1.2 codetools_0.2-15
[36] htmltools_0.3.6 splines_3.4.3 colorspace_1.3-2 stringi_1.1.6 acepack_1.4.1
[41] lazyeval_0.2.1 munsell_0.4.3
The last update of SASxport happend nearly two years ago (2016-03-11). So the Hmisc package it imports might have changed in the meantime. Looking up the Hmisc archive I found the version number on 2016-03-11 to be 3.17-2. So installing this version fixes the problem:
library("devtools")
install_version("Hmisc", version = "3.17-2")
Two reasons speak against using SASxport in this case:
You need to use a old version of a package which might happer your work in later steps.
SASxport needs Hmisc for a task that Hmisc can do already by itself, so SASxport is expendable when reading in XPT files.

Images not showing in R notenook (nb.html file)

When I knit to HTML, images show up fine in the .html file, but not the .nb.html one. MWE is the R Notebook template: the plot(cars) image does not show.
Per suggestions listed here: RStudio notebook does not show data.frames when I compile, I tried older/newer/dev versions of rmarkdown. I also tried newer/dev versions of knitr. Nothing helped. I have RStudio version 1.0.136.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5
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] devtools_1.12.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 withr_1.0.2 digest_0.6.11 rprojroot_1.2 R6_2.2.0
[6] jsonlite_1.2 backports_1.0.5 git2r_0.15.0 magrittr_1.5 evaluate_0.10
[11] highr_0.6 httr_1.2.1 stringi_1.1.2 curl_2.3 rstudioapi_0.6
[16] rmarkdown_1.3 tools_3.3.2 stringr_1.1.0 yaml_2.1.14 rsconnect_0.7
[21] base64enc_0.1-3 memoise_1.0.0 htmltools_0.3.5 knitr_1.15.8
Thanks to RStudio for pointing out that this is expected behavior. I had switched the chunk output setting to Chunk Output in Console so I could view plots in the plot window. I didn't realize that all chunks must be run inline to appear in the notebook. I switched back to Chunk Output Inline, ran the chunks, and all was well.

Error loading rmarkdown document after time period on shiny server

Cleaning up this question (https://stackoverflow.com/questions/36564482/multiple-rmarkdown-files-on-shiny-server)
I am trying to deploy .Rmd files on a shiny server. This works at first i.e. when I first load the page everything loads correctly. It even loads two or three times. However, eventually it stops working and I get this error:
path[1]="/tmp/Rtmpcmbz6g/widgetbinding19405f628a16": No such file or directory
If I save the file in a new directory, it works again for a while then fails. The head of my .Rmd document looks like this:
---
output:
html_document:
toc: true
toc_float: true
---
In the document I import data from elsewhere on the server:
```{r, include=FALSE}
ERF <- 1001
ws <- paste("/media/erf_data/ERF",ERF,"/raw_data", sep="")
setwd(ws)
tdata <- paste("ERF", ERF, "_Transistor.csv", sep="")
tran <- read.csv(tdata)
```
This is my sessioninfo:
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.1 dplyr_0.4.3 gridExtra_2.0.0 scales_0.3.0
[5] nlme_3.1-126 plyr_1.8.3 ggthemes_2.2.1 ggplot2_1.0.1
[9] splitstackshape_1.4.2 data.table_1.9.6 sqldf_0.4-10 RSQLite_1.0.0
[13] gsubfn_0.6-6 proto_0.3-10 RMySQL_0.10.7 DBI_0.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 formatR_1.2.1 tools_3.2.4 digest_0.6.8 jsonlite_0.9.19
[6] gtable_0.1.2 lattice_0.20-33 yaml_2.1.13 parallel_3.2.4 stringr_1.0.0
[11] knitr_1.11 htmlwidgets_0.5 R6_2.1.1 tcltk_3.2.4 rmarkdown_0.9.5
[16] reshape2_1.4.1 magrittr_1.5 htmltools_0.3 MASS_7.3-44 assertthat_0.1
[21] colorspace_1.2-6 labeling_0.3 stringi_1.0-1 lazyeval_0.1.10 munsell_0.4.2
[26] chron_2.3-47
Is there any more information I can provide that will help me find a solution to this?
I got this error, too.
It happens when I am hyperlinking a Shiny App page from a Rmd page.
It works fine before you click on that hyperlink. After one click, the Rmd page will stop working giving me errors similar to yours.
The fix I found is to edit your Rmd file and save.
This seems to make Rmd refresh on the Shiny Server and solve this issue.
However, if you still want to hyperlink it, it will stop working the moment you click on it.
This may seem like a diff between server session timeout and caching. What's your configuration on this?

R rmarkdown::render() looses js dependencies of DT::datatable()

The problem
I am trying to use rmarkdown::render function to generate a standalone html report with tables formated using DT::datatable function. I seem to loose JavaScript dependencies using this approach if I output the report to other directory than the working one.
On the other hand, everything works fine if I press the Knit button in RStudio. Report is generated, tables are formated as expected. I can send the report via email. I can copy the report using ctrl + c and paste it wherever using ctrl + v. It just works. However, it does not work for me if I copy the .html report to other folder using file.copy.
What I tried
I looked at and read Howto include js dependencies of DT datatable in Rmarkdown using knitr and pandoc, I also tried to understand knit DT::datatable without pandoc. I stil cannot get it to work.
As always, there must be some simple option I am missing. Could you help please.
Session Info
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Slovenian_Slovenia.1250 LC_CTYPE=Slovenian_Slovenia.1250 LC_MONETARY=Slovenian_Slovenia.1250
[4] LC_NUMERIC=C LC_TIME=Slovenian_Slovenia.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] printr_0.0.4 DT_0.1 markdown_0.7.7 rmarkdown_0.8 knitr_1.11 dplyr_0.4.3 stringr_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.0 digest_0.6.8 assertthat_0.1 R6_2.1.1 jsonlite_0.9.16 DBI_0.3.1 formatR_1.2 magrittr_1.5
[9] evaluate_0.7.2 highr_0.5 stringi_0.5-5 lazyeval_0.1.10 rstudioapi_0.3.1 tools_3.2.0 htmlwidgets_0.5 yaml_2.1.13
[17] parallel_3.2.0 htmltools_0.2.6

Can't run glmnet() R package : " could not find function "lengths" "

I'm using glmnet R package. And before today I had no problems using it. I installed caret two days ago, I had some troubles to install it but I succeeded to do some by re-installing some packages like.
Here is the error message I get :
Error in .fixupDimnames(.Object#Dimnames) :
could not find function "lengths"
I'm using an old version of R, that I can't update right now.
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] glmnet_2.0-2 foreach_1.4.2 Matrix_1.2-2 caret_6.0-52 ggplot2_0.9.3.1 lattice_0.20-23 ade4_1.6-2
loaded via a namespace (and not attached):
[1] BradleyTerry2_1.0-6 brglm_0.5-9 car_2.0-19 codetools_0.2-11 colorspace_1.2-4 compiler_3.0.2
[7] dichromat_2.0-0 digest_0.6.4 grid_3.0.2 gtable_0.1.2 gtools_3.5.0 iterators_1.0.7
[13] labeling_0.2 lme4_1.1-8 MASS_7.3-29 minqa_1.2.4 munsell_0.4.2 nlme_3.1-111
[19] nloptr_1.0.4 nnet_7.3-7 plyr_1.8 pROC_1.8 proto_0.3-10 RColorBrewer_1.0-5
[25] Rcpp_0.12.0 reshape2_1.2.2 scales_0.2.3 splines_3.0.2 stats4_3.0.2 stringr_0.6.2
[31] tools_3.0.2
The error is obtained after calling :
gg <- glmnet(x=data, y=Y.train, family="binomial", alpha=0, lambda=1)
Y.train is factor, and data a matrix of dummies. But I think that the issue is not a matter of data.
But it is more likely something linked with a package or something like this that I'm missing.
If anybody has a clue, it would be great.
I reinstall Matrix_1.1-1.tar.gz, and it worked.
So, you can try to change your Matrix package.

Resources