JBrenn / SWCalibrateR

Flexible R-Shiny toolbox for calibration of soil moisture sensors
https://github.com/JBrenn/SWCalibrateR
MIT License
4 stars 4 forks source link

Test online version of app with new R package version #11

Closed JBrenn closed 6 years ago

JBrenn commented 6 years ago

As data structure has been changed (read in of default data from /data/SensorVSample.RData does need loading of package SMCcalibration) the online shiny app has to be tested.

GiulioGenova commented 6 years ago

Hi Johanness,

Yes at the moment the app (downloaded form this repo) is not working and yields the following error. You think is better that I try to fix it or you want to do it by yourself?

Warning: Error in rep: invalid 'times' argument 50: reactiveValues 49: server [C:\Users\GGenova\AppData\Local\Temp\Rtmp0uO9J1\shinyapp35d46dd41959\SMCcalibration-MultiSelect\R/server.R#4] Error in rep(x = TRUE, times = nrow(data)) : invalid 'times' argument

JBrenn commented 6 years ago

Hey Giulio,

best option for me would be if you could fix it - if you already know how to and as it is a EURAC repository where the app is published?! I did change some data reading to the app, to be consistent with the R package structure. At the moment the R package does install, which was no more possible with you branch.

Best option would be a R package that does install, so one can run the shiny app offline easily, and on the other hand a product that is available online. If both is not possible in the MASTER code trunk, we will have to do a branch for the online version.

JBrenn commented 6 years ago

For me after commit JBrenn@4070fd1a7f694c2f4a441891343f9a262b46b5bf the following test is working well:

shiny::runGitHub('JBrenn/SMCcalibration',  subdir="R",  launch.browser = TRUE)

@GiulioGenova could you also try once more. Does this mean the software should also work as an online application?

GiulioGenova commented 6 years ago

when I try to install the package I get the following error:

Downloading GitHub repo JBrenn/SMCcalibration@master
from URL https://api.github.com/repos/JBrenn/SMCcalibration/zipball/master
Installing SMCcalibration
Installation failed: Invalid comparison operator in dependency: leaflet (>=2.0.2), leaflet.extras (>=1.0.0), robustbase (0.93-3), tidyr (>=0.8.1)

Yes the code:

shiny::runGitHub('JBrenn/SMCcalibration',  subdir="R",  launch.browser = TRUE)

Is still not working. I get this:

> shiny::runGitHub('JBrenn/SMCcalibration',  subdir="R",  launch.browser = TRUE)
Downloading https://github.com/JBrenn/SMCcalibration/archive/master.tar.gz

Listening on http://127.0.0.1:7551
Warning: Error in rep: invalid 'times' argument
  50: reactiveValues
  49: server [C:\Users\GGenova\AppData\Local\Temp\RtmpOqRBqC\shinyapp2bdc3f52578e\SMCcalibration-master\R/server.R#91]
Error in rep(TRUE, nrow(data)) : invalid 'times' argument

seems like is not finding "the data" file or it is null. may be for you is working because you have loaded the package?

to put the app online I actually only need to make the app run in RStudio (no matter how) and then I deploy It on the shinyapps.ui servers

JBrenn commented 6 years ago

Ok got this.

My workflow at the moment is the following:

library(SMCcalibration)
data("SensorVSample")
shiny::runGitHub('JBrenn/SMCcalibration',  subdir="R",  launch.browser = TRUE)

This is working. And if its also working for the shinyapps.ui server COOL :) So we can deploy to there the next days and close this issue after.

GiulioGenova commented 6 years ago

@JBrenn great, we are almost there.

I managed to install the package. I needed R 3.5 and had to install manually some libraries ("jsonlite","rcurl") I deployed the app online but it crashes. I thing it's because it can't find the SMCcalibration package. One solution could be to place in the ui.R or in server.R the following lines:

if (!require("devtools")) install.packages("devtools")
if (!require("SMCcalibration")) install_github("JBrenn/SMCcalibration")

So that the package can be installed on shinyapps.io servers

JBrenn commented 6 years ago

see Email today:

I did restructure the package a bit. Added an inst/shiny folder, moved ui.R and server.R there, wrote some wrapper to stat app locally and in shinyapps.io. Shiny app can be run now locally by

devtools::install_github(SMCcalibration)
runShinyapp()

I also successfully deployed the app to shinyapps.io, see https://jgbr.shinyapps.io/shiny/

devtools::install_github(SMCcalibration)
deployApp(‘inst/shiny’)

Giulio could you try once more for the alpenv shinyapps.io account?

GiulioGenova commented 6 years ago

Great, it works now! So the problem was just finding the data file, right?

if (!require("SMCcalibration")) install_github("JBrenn/SMCcalibration")

was not needed as rsconnect looks for the needed packages already nice!

JBrenn commented 6 years ago

Perfect! Yes, lib SMCcalibration and example data set are loaded before server function...

library(SMCcalibration)
data("SensorVSample")