<commit_before>library(rgeos)
library(rgdal)
library(leaflet)
load("map.rda") 
spToGeoJSON <- function(x){
  tf<-tempfile()
  writeOGR(x, tf,layer = "geojson", driver = "GeoJSON")
  js <- paste(readLines(tf), collapse=" ")
  file.remove(tf)
  return(js)
}

ui <- bootstrapPage(
    tags$head(includeScript("google-analytics.js")),
    tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
    leafletOutput("map", width = "100%", height = "100%"),
    absolutePanel(top = 10, right = 10,
                  numericInput("feetbuffer", label = h3("Buffer In Feet"), 1000)
                  )
    )

server <- function(input, output, session) {
  filteredData <- reactive({
    spTransform(map, CRS("+init=epsg:26934")) %>%  
     gBuffer(width = input$feetbuffer / 3.28084) %>%
     spTransform(CRS("+proj=longlat")) %>%
     as("SpatialPolygonsDataFrame")
  })
  output$map <- renderLeaflet({
    leaflet() %>% addTiles(urlTemplate = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png") %>% setView(-149.85, 61.15, zoom = 12) %>%
      addGeoJSON(spToGeoJSON(filteredData()))
  })
  observe({
    leafletProxy("map", data = filteredData()) 
  })
}
  
shinyApp(ui, server)<commit_msg>add text and remove custom function<commit_after>library(rgeos)
library(rgdal)
library(leaflet)
library(geojsonio)
load("map.rda") 

ui <- bootstrapPage(title = "Cannabis Cafe Zoning",
    tags$head(includeScript("google-analytics.js")),
    tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
    leafletOutput("map", width = "100%", height = "100%"),
    absolutePanel(class = "panel panel-default",top = 10, right = 10, width = 330,
                  p("Since recent state initiaitves passed to legalize the retail sale of Cannabis, local communities have been proposing and enacting zoning laws distancing new stores from schools and daycares. This interactive map of anchorage allows you to simulate the effect of this kind of zoning law across Anchorage."),  
                  p("Using the publicly available parcel data from 2014 for over 200 zoned schools and daycares you can visualize the effect that different distance buffers would have selectively where Anchorage's first marijuana cafes would be."),                  
                  numericInput("feetbuffer", label = h4("Buffer In Feet"), 1000)
                  )
    )

server <- function(input, output, session) {
  filteredData <- reactive({
    spTransform(map, CRS("+init=epsg:26934")) %>%  
     gBuffer(width = input$feetbuffer / 3.28084) %>%
     spTransform(CRS("+proj=longlat")) %>%
     as("SpatialPolygonsDataFrame")
  })
  output$map <- renderLeaflet({
    leaflet() %>% addTiles(urlTemplate = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png") %>% setView(-149.85, 61.15, zoom = 12) %>%
      addGeoJSON(geojson_json((filteredData())))
  })
  observe({
    leafletProxy("map", data = filteredData()) 
  })
}
  
shinyApp(ui, server)
{'fraction_non_alphanumeric': 0.15893587994542974, 'fraction_numerical': 0.03274215552523874, 'mean_word_length': 3.7230273752012883, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7189437', 'n_tokens_mistral': 1060, 'n_tokens_neox': 927, 'n_words': 218}