Wi-Fi Speeds at MTSU:

The table and map below show results from wi-fi speed tests run on campus at MTSU.

##                        location download upload speed_category
## 1                 Student Union    40.70  41.40       Moderate
## 2             Business Building    81.00  58.10       Moderate
## 3                Walker Library     2.48   5.24           Slow
## 4          School of Journalism    63.50  48.00       Moderate
## 5                          Seal    44.30   1.34       Moderate
## 6                     Peck Hall   130.00 111.00           Fast
## 7                     Todd Hall    18.90   0.42           Slow
## 8        Davis Science Building   290.00 307.00           Fast
## 9  Cope Administration Building   218.00 274.00           Fast
## 10             Science Building    30.50  49.80       Moderate
## 11                   Jones Hall    21.00   6.41           Slow
## 12  Keathly University Building    70.20   1.99       Moderate
## 13    Learning Resources Center    36.60   5.11       Moderate
## 14            Recreation Center    81.10  61.10       Moderate
## 15            Concrete Building   201.00 279.00           Fast
## 16 Applied Engineering Building    97.20  21.50       Moderate
## 17                  MT One Stop     6.61   0.89           Slow
## 18   Telecommunication Building    59.00   5.88       Moderate
## 19               Tucker Theater    89.50   9.27       Moderate
## 20  Academic Classroom Building   128.00  38.60           Fast
## 21               Honors College    47.50   2.53       Moderate
## 22         College of Education    32.60   5.49       Moderate
## 23                Cummings Hall    25.60  86.10       Moderate
## 24                  Corlew Hall    11.10   1.82           Slow
## 25                   Deere Hall    88.20 108.00       Moderate
## 26                   Nicks Hall    17.40  25.40           Slow
## 27                    Greek Row    50.60  92.00       Moderate
## 28             Scarlett Commons    43.40  49.70       Moderate
## 29                   Smith Hall    51.10  69.00       Moderate

CODE:

# ================================
# WIFI MAP + TABLE (FINAL CLEAN DATA)
# ================================

# ---- INSTALL PACKAGES (run once) ----
required_packages <- c("dplyr", "leaflet")
installed <- rownames(installed.packages())

for (pkg in required_packages) {
  if (!(pkg %in% installed)) {
    install.packages(pkg)
  }
}

# ---- LOAD LIBRARIES ----
library(dplyr)
library(leaflet)

# ---- DATA (FULLY UPDATED FROM EXCEL) ----
data <- data.frame(
  location = c(
    "Student Union","Business Building","Walker Library","School of Journalism","Seal",
    "Peck Hall","Todd Hall","Davis Science Building","Cope Administration Building",
    "Science Building","Jones Hall","Keathly University Building","Learning Resources Center",
    "Recreation Center","Concrete Building","Applied Engineering Building","MT One Stop",
    "Telecommunication Building","Tucker Theater","Academic Classroom Building",
    "Honors College","College of Education","Cummings Hall","Corlew Hall",
    "Deere Hall","Nicks Hall","Greek Row","Scarlett Commons","Smith Hall"
  ),

  download = c(
    40.7,81,2.48,63.5,44.3,130,18.9,290,218,30.5,21,70.2,36.6,81.1,201,97.2,6.61,
    59,89.5,128,47.5,32.6,25.6,11.1,88.2,17.4,50.6,43.4,51.1
  ),

  upload = c(
    41.4,58.1,5.24,48,1.34,111,0.42,307,274,49.8,6.41,1.99,5.11,61.1,279,21.5,0.89,
    5.88,9.27,38.6,2.53,5.49,86.1,1.82,108,25.4,92,49.7,69
  ),

  latitude = c(
    35.8480801,35.8476898,35.8466057,35.8469993,35.8470788,
    35.8482009,35.8480879,35.8473438,35.8463273,35.8465822,
    35.8489077,35.8479552,35.8477650,35.8465136,35.8456242,
    35.8446058,35.8475226,35.8521744,35.8498182,35.8496884,
    35.8469103,35.8476470,35.8488421,35.8489426,35.8454175,
    35.8452892,35.8452310,35.8495912,35.8461582
  ),

  longitude = c(
    -86.3607044,-86.3637499,-86.3638710,-86.3626501,-86.3638199,
    -86.3689267,-86.3674584,-86.3672644,-86.3690643,-86.3651371,
    -86.3674828,-86.3661543,-86.3651213,-86.3588850,-86.3611318,
    -86.3613077,-86.3592142,-86.3635315,-86.3657456,-86.3618030,
    -86.3607245,-86.3619876,-86.3627676,-86.3647344,-86.3633934,
    -86.3627416,-86.3528890,-86.3583316,-86.3675835
  )
)

# ---- CLASSIFY SPEEDS ----
data <- data %>%
  mutate(
    speed_category = case_when(
      download >= 100 ~ "Fast",
      download >= 25 ~ "Moderate",
      TRUE ~ "Slow"
    ),
    
    color = case_when(
      speed_category == "Fast" ~ "green",
      speed_category == "Moderate" ~ "orange",
      speed_category == "Slow" ~ "red"
    )
  )

# ---- TABLE OUTPUT ----
wifi_table <- data %>%
  select(location, download, upload, speed_category)

print(wifi_table)

# ---- POPUPS ----
data <- data %>%
  mutate(
    popup = paste0(
      "<b>", location, "</b><br>",
      "Download: ", download, " Mbps<br>",
      "Upload: ", upload, " Mbps<br>",
      "Category: ", speed_category
    )
  )

# ---- MAP ----
leaflet(data) %>%
  addTiles() %>%
  addCircleMarkers(
    lng = ~longitude,
    lat = ~latitude,
    color = ~color,
    radius = 7,
    fillOpacity = 0.9,
    popup = ~popup
  ) %>%
  addLegend(
    "bottomright",
    colors = c("green", "orange", "red"),
    labels = c("Fast (100+ Mbps)", "Moderate (25–99 Mbps)", "Slow (<25 Mbps)"),
    title = "Wi-Fi Speed"
  )