title: How to plot a map from gadm in shiny r?
body: <p>im new to shiny and currrently m trying to plot the map of Pakistan in my shiny app. The code that im currently using works perfectly on the console, but im not quite sure as to how to implement it in my shiny app. [![Console Output][1]][1]THE code:</p>
  
  <pre><code>library(maptools)
  library(raster)
      adm &lt;- raster::getData('GADM', country='PAK', level=2),
            mar&lt;-(adm),
            plot(mar, bg="dodgerblue", axes=T),
            ##Plot downloaded data
            plot(mar, lwd=10, border="skyblue", add=T),
            plot(mar,col="green4", add=T),
            grid(),
            box(),
            invisible(text(getSpPPolygonsLabptSlots(mar), labels=as.character(mar$NAME_2), cex=1.1, col="white", font=2)),
            mtext(side=3, line=1, "Pakistan", cex=2),
            mtext(side=1, "Longitude", line=2.5, cex=1.1),
            mtext(side=2, "Latitude", line=2.5, cex=1.1) 
  </code></pre>
  
  #
  
  <p>This is what im currently doing in the Shiny app:</p>
  
  <pre><code>**ui.r**
  
      shinyUI(
        navbarPage(
          inverse = TRUE,
          title = "Campaign Launch Demo",
      tabPanel("Daily Insights",
      sidebarLayout(
            sidebarPanel( )
  
  
       mainPanel(
            fluid = TRUE,
          uiOutput('map2')
          )
          )
          )
          )
          )
  
  and this the code for the server script:
       **server.R**
         shinyServer(function(input, output, session){
           output$map2 &lt;- 
              print(
                ## Download data from gadm.org 
                adm &lt;- raster::getData('GADM', country='PAK', level=2),
                mar&lt;-(adm),
                plot(mar, bg="dodgerblue", axes=T),
                ##Plot downloaded data
                plot(mar, lwd=10, border="skyblue", add=T),
                plot(mar,col="green4", add=T),
                grid(),
                box(),
                invisible(text(getSpPPolygonsLabptSlots(mar), labels=as.character(mar$NAME_2), cex=1.1, col="white", font=2)),
                mtext(side=3, line=1, "Pakistan", cex=2),
                mtext(side=1, "Longitude", line=2.5, cex=1.1),
                mtext(side=2, "Latitude", line=2.5, cex=1.1)
          )   }
  
  
  
    [1]: 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ihfvM.png" rel="nofollow noreferrer">https://i.stack.imgur.com/ihfvM.png</a></p>