Wi-Fi Speeds at MTSU:

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

##                        location download_speed upload_speed 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             NA           NA        No Data
## 21               Honors College          47.50         2.53       Moderate
## 22         College of Education             NA           NA        No Data
## 23                Cummings Hall             NA           NA        No Data
## 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             NA           NA        No Data
## 28             Scarlett Commons             NA           NA        No Data
## 29                   Smith Hall          51.10        69.00       Moderate

CODE:

# ================================
# WIFI MAP + TABLE 
# ================================

# ---- 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)

# ---- MANUALLY CREATE DATA ----
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_speed = 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,
    NA,47.5,NA,NA,11.1,88.2,17.4,NA,NA,51.1
  ),
  
  upload_speed = 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,
    NA,2.53,NA,NA,1.82,108,25.4,NA,NA,69
  ),
  
  latitude = c(
    35.84808,35.84769,35.84661,35.84700,35.84708,35.84820,35.84809,35.84734,35.84633,
    35.84658,35.84891,35.84796,35.84777,35.84651,35.84562,35.84461,35.84752,35.85217,
    35.84982,35.84969,35.84691,35.84765,35.84884,35.84894,35.84542,35.84529,35.84523,
    35.84959,35.84616
  ),
  
  longitude = c(
    -86.36070,-86.36375,-86.36387,-86.36265,-86.36382,-86.36893,-86.36746,-86.36726,
    -86.36906,-86.36514,-86.36748,-86.36615,-86.36512,-86.35888,-86.36113,-86.36131,
    -86.35921,-86.36353,-86.36575,-86.36180,-86.36072,-86.36199,-86.36277,-86.36473,
    -86.36339,-86.36274,-86.35289,-86.35833,-86.36758
  )
)

# ---- CLASSIFY SPEEDS ----
data <- data %>%
  mutate(
    speed_category = case_when(
      is.na(download_speed) ~ "No Data",
      download_speed >= 100 ~ "Fast",
      download_speed >= 25 ~ "Moderate",
      TRUE ~ "Slow"
    ),
    
    color = case_when(
      speed_category == "Fast" ~ "green",
      speed_category == "Moderate" ~ "orange",
      speed_category == "Slow" ~ "red",
      TRUE ~ "gray"
    )
  )

# ---- CREATE TABLE ----
wifi_table <- data %>%
  select(location, download_speed, upload_speed, speed_category)

print(wifi_table)

# ---- POPUPS ----
data <- data %>%
  mutate(
    popup = paste0(
      "<b>", location, "</b><br>",
      "Download: ", ifelse(is.na(download_speed), "N/A", download_speed), " Mbps<br>",
      "Upload: ", ifelse(is.na(upload_speed), "N/A", upload_speed), " Mbps<br>",
      "Category: ", speed_category
    )
  )

# ---- CREATE 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", "gray"),
    labels = c("Fast (100+ Mbps)", "Moderate (25–99 Mbps)", "Slow (<25 Mbps)", "No Data"),
    title = "Wi-Fi Speed"
  )