Shiny Application using shapefiles and leaflet deploying but with error (rgdal...)

Hi All,

I have a simple app - leaflet map with turn off and on shapefile layers.

My error message insists I need rgdal (which i have installed, but do not call with librar()), but the deployment error states rgdal is not available.

Here is my error

https://laleenok.shinyapps.io/Interactive_Map/

and here are my logs.

2019-02-01T11:41:49.516215+00:00 shinyapps[682049]: Starting R with process ID: '18'
2019-02-01T11:41:49.547177+00:00 shinyapps[682049]:
2019-02-01T11:41:49.547174+00:00 shinyapps[682049]:
2019-02-01T11:41:49.555565+00:00 shinyapps[682049]: Attaching package: ‘rsconnect’
2019-02-01T11:41:49.547935+00:00 shinyapps[682049]: The following object is masked from ‘package:graphics’:
2019-02-01T11:41:49.547936+00:00 shinyapps[682049]:
2019-02-01T11:41:49.547937+00:00 shinyapps[682049]: box
2019-02-01T11:41:49.585469+00:00 shinyapps[682049]: Loading required package: sp
2019-02-01T11:41:49.547937+00:00 shinyapps[682049]:
2019-02-01T11:41:49.555549+00:00 shinyapps[682049]:
2019-02-01T11:41:49.547176+00:00 shinyapps[682049]: Attaching package: ‘shinydashboard’
2019-02-01T11:41:49.555886+00:00 shinyapps[682049]: serverInfo
2019-02-01T11:41:49.555566+00:00 shinyapps[682049]:
2019-02-01T11:41:49.555887+00:00 shinyapps[682049]:
2019-02-01T11:41:49.555886+00:00 shinyapps[682049]:
2019-02-01T11:41:49.555885+00:00 shinyapps[682049]: The following object is masked from ‘package:shiny’:
2019-02-01T11:41:50.615355+00:00 shinyapps[682049]: Error in value[3L] : package 'rgdal' is not available
2019-02-01T11:41:50.615357+00:00 shinyapps[682049]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
2019-02-01T11:41:50.615358+00:00 shinyapps[682049]: Execution halted
2019-02-01T11:41:55.457267+00:00 shinyapps[682049]: Server version: 1.7.0-11
2019-02-01T11:41:55.457307+00:00 shinyapps[682049]: LANG: en_GB.UTF-8
2019-02-01T11:41:55.457309+00:00 shinyapps[682049]: R version: 3.4.3
2019-02-01T11:41:55.457316+00:00 shinyapps[682049]: shiny version: 1.0.5
2019-02-01T11:41:55.457317+00:00 shinyapps[682049]: httpuv version: 1.3.5
2019-02-01T11:41:55.457335+00:00 shinyapps[682049]: rmarkdown version: NA
2019-02-01T11:41:55.457336+00:00 shinyapps[682049]: knitr version: NA
2019-02-01T11:41:55.457344+00:00 shinyapps[682049]: jsonlite version: 1.5
2019-02-01T11:41:55.457357+00:00 shinyapps[682049]: RJSONIO version: NA
2019-02-01T11:41:55.457358+00:00 shinyapps[682049]: htmltools version: 0.3.6
2019-02-01T11:41:55.610587+00:00 shinyapps[682049]: Using jsonlite for JSON processing
2019-02-01T11:41:55.457463+00:00 shinyapps[682049]: Using pandoc at /opt/connect/ext/pandoc2
2019-02-01T11:41:55.708800+00:00 shinyapps[682049]:
2019-02-01T11:41:55.708802+00:00 shinyapps[682049]: Starting R with process ID: '38'
2019-02-01T11:41:55.740802+00:00 shinyapps[682049]: Attaching package: ‘shinydashboard’
2019-02-01T11:41:55.740801+00:00 shinyapps[682049]:
2019-02-01T11:41:55.741572+00:00 shinyapps[682049]: The following object is masked from ‘package:graphics’:
2019-02-01T11:41:55.741573+00:00 shinyapps[682049]:
2019-02-01T11:41:55.741574+00:00 shinyapps[682049]: box
2019-02-01T11:41:55.740803+00:00 shinyapps[682049]:
2019-02-01T11:41:55.749641+00:00 shinyapps[682049]: Attaching package: ‘rsconnect’
2019-02-01T11:41:55.749979+00:00 shinyapps[682049]:
2019-02-01T11:41:55.749978+00:00 shinyapps[682049]: The following object is masked from ‘package:shiny’:
2019-02-01T11:41:55.749642+00:00 shinyapps[682049]:
2019-02-01T11:41:55.749980+00:00 shinyapps[682049]: serverInfo
2019-02-01T11:41:55.776112+00:00 shinyapps[682049]: Loading required package: sp
2019-02-01T11:41:55.749980+00:00 shinyapps[682049]:
2019-02-01T11:41:55.741575+00:00 shinyapps[682049]:
2019-02-01T11:41:55.749639+00:00 shinyapps[682049]:
2019-02-01T11:41:56.926632+00:00 shinyapps[682049]: Error in value[3L] : package 'rgdal' is not available
2019-02-01T11:41:56.926646+00:00 shinyapps[682049]: Execution halted
2019-02-01T11:41:56.926645+00:00 shinyapps[682049]: Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->

Thanks for any help!

You may have rgdal in your local system, but you need to have rgdal on shinyapps.io server, the way to ensure that this dependency is available is explicitly calling the library, try including library(rgdal) in your code and deploy again to shinyapps.io

Also make sure that you are using relative paths instead of absolute ones, if you are reading files into your app.

1 Like

Thank you!

It appears using rgdal's readOGR fixes that problem too.

Also what do you mean relative paths? Is this relative Site <- readOGR("./Site", layer = "Site")

As you predicted, i now have a cannot source data error.

Thanks

A relative path refers to a location that is relative to a current directory. Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy. A single dot represents the current directory itself.

You can try your relative paths beforehand in your local file browser to make sure they work as expected.

Also make sure that you are deploying the actual files along with the app.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.