Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

?tmapOutput - example does not work #473

Closed
Nowosad opened this issue Jul 13, 2020 · 0 comments
Closed

?tmapOutput - example does not work #473

Nowosad opened this issue Jul 13, 2020 · 0 comments
Labels

Comments

@Nowosad
Copy link
Collaborator

@Nowosad Nowosad commented Jul 13, 2020

An example in the ?tmapOutput help file returns an error:

library(tmap)
library(shiny)
data(World)
world_vars <- setdiff(names(World), c("iso_a3", "name", "sovereignt", "geometry"))


ui <- fluidPage(
  tmapOutput("map"),
  selectInput("var", "Variable", world_vars)
)

server <- function(input, output, session) {
  output$map <- renderTmap({
    tm_shape(World) +
      tm_polygons(world_vars[1], zindex = 401)
  })
  
  observe({
    var <- input$var
    tmapProxy("map", session, {
      tm_remove_layer(401) +
        tm_shape(World) +
        tm_polygons(var, zindex = 401)
    })
  })
}	


app <- shinyApp(ui, server)
if (interactive()) app
Warning: Error in if: argument is of length zero
  [No stack trace available]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant