2

I am having issues getting a map using tmap to load in shiny. When I run the shiny code, the input sections show up, but not the output. The code doesn't crash, but it also never finishes running. My goal is to be able to have an interactive map using tmap and leaflet, which has been able to run outside of shiny.

library(tmap) # and maybe also: library(tmaptools)
library(shiny)

ui <- fluidPage(
  titlePanel("Europe"),

  mainPanel(
    plotOutput(outputId = "europe")))

server <- function(input, output) {

  output$europe <- renderPlot({
    qtm(Europe)})}

shinyApp(ui, server)
Jaap
  • 81,064
  • 34
  • 182
  • 193
Emma
  • 63
  • 1
  • 6

1 Answers1

2

All works for me:

library(shiny)
library(tmap)
data("Europe")

ui <- fluidPage(
  titlePanel("Europe"),
  mainPanel(
    plotOutput(outputId = "europe")))

server <- function(input, output) {

  output$europe <- renderPlot({
    qtm(Europe)
  })
}

shinyApp(ui, server)

enter image description here

Pork Chop
  • 28,528
  • 5
  • 63
  • 77
  • What versions of R, shiny, and tmap are you using? Could those affect the performance? – Emma Jun 13 '18 at 16:46
  • I'm on R version 3.3.2 and just downloaded the `tmap` from CRAN so on `1.11-2`. In not sure about performance, I have a powerful machine with 64GB Ram – Pork Chop Jun 13 '18 at 16:54
  • Using your code made the map load into the shiny window, but the code doesn't finish loading. Any suggestions? – Emma Jun 13 '18 at 17:23