library(leaflet)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readr)

food_prices <- read_csv("C:/Users/Digital Outlet/Documents/food_prices1.csv")
## Rows: 17607 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): date, admin1, admin2, market, category, commodity, unit
## dbl (3): latitude, longitude, price
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
food_prices <- na.omit(food_prices)
head(food_prices)
food_prices$latitude <- as.numeric(as.character(food_prices$latitude))
food_prices$longitude <- as.numeric(as.character(food_prices$longitude))
# food_prices$Price <- as.numeric(as.character(food_prices$Price))
head(food_prices)
leaflet(food_prices) %>%
  addTiles() %>%  # base map
  addCircleMarkers(
    lng = ~longitude,
    lat = ~latitude,
    radius = ~sqrt(price),
    color = "black",
    fillColor = "yellow",
    fillOpacity = 0.6,
    stroke = TRUE,
    weight = 1,
    popup = ~paste(
      "<b>Market:</b>", market, "<br>",
      "<b>Admin2:</b>", admin2, "<br>",
      "<b>Commodity:</b>", commodity, "<br>",
      "<b>Category:</b>", category, "<br>",
      "<b>Price:</b>", price
    )
  ) %>%
  addLegend(
    position = "bottomright",
    title = "Price (size of bubbles)",
    colors = "blue",
    labels = "Relative bubble size = Price"
  )

C:/Users/Digital Outlet/Documents/food_prices1.csv