Vanuatu-National-Statistics-Office / vnso-trade-dashboard

GNU General Public License v3.0
0 stars 0 forks source link

Dashboard map error #2

Open trara538 opened 3 years ago

trara538 commented 3 years ago

Hi Joe, I have created a new repository for the Trade Dashboard and migrated the Trade dashboard from the old version to the new one. It comes with the following error:

"Quitting from lines 775-782 (TDashboard.Rmd) Warning: Error in merge: object 'worldSimple' not found 139: merge 138: eval 137: eval 132: evaluate_call 131: evaluate::evaluate 130: evaluate 128: eng_r 127: block_exec 126: call_block 125: process_group.block 122: process_file 121: knitr::knit 120: 115: 99: doc 98: renderUI 97: func 84: renderFunc 83: output$reactivedoc 3: 1: rmarkdown::run"

JosephCrispell commented 3 years ago

Hi @trara538,

I don't have the my-db.sqlite SQLite database so can't fully test the dashboard but I think the error you are getting is caused by include = FALSE here: https://github.com/Vanuatu-National-Statistics-Office/vnso-trade-dashboard/blob/4561ca540373e876918afb318ed5a4dfbbda6d81/TDashboard.Rmd#L761 which means the code to read the countries boundaries shape file isn't turned on and the worldSimple variable is never created - note this requires the ne_50m_admin_0_countries/ne_50m_admin_0_countries.shp to be present in the current working directory (which is C:/DataViz/Trades/SQLite_Flexdashboard). Also this might be better replaced with code we use for the monthly report world map:

  # Get the polygons for the world
  world <- rnaturalearth::ne_countries(type = "countries", scale = "small", returnclass = "sf")

which loads the country boundaries from the rnaturalearth package instead of requiring a local file. Note that you'd need to update the column used for merging from CTY_ID to iso_a2 in this code: https://github.com/Vanuatu-National-Statistics-Office/vnso-trade-dashboard/blob/4561ca540373e876918afb318ed5a4dfbbda6d81/TDashboard.Rmd#L776

A couple of additional notes:

I hope the above is useful!

Joe