# install packages
library(corrplot)
## corrplot 0.92 loaded
library(ggplot2)
library(reshape2)
library(liver)
## 
## Attaching package: 'liver'
## The following object is masked from 'package:base':
## 
##     transform
library(tidyr)
## 
## Attaching package: 'tidyr'
## The following object is masked from 'package:reshape2':
## 
##     smiths
library(leaps)
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
#read data
data <- data(house)
# Check our NA
length(which(is.na(house), arr.ind=TRUE))
## [1] 0

EDA

summary(house)
##    house.age      distance.to.MRT   stores.number       latitude    
##  Min.   : 0.000   Min.   :  23.38   Min.   : 0.000   Min.   :24.93  
##  1st Qu.: 9.025   1st Qu.: 289.32   1st Qu.: 1.000   1st Qu.:24.96  
##  Median :16.100   Median : 492.23   Median : 4.000   Median :24.97  
##  Mean   :17.713   Mean   :1083.89   Mean   : 4.094   Mean   :24.97  
##  3rd Qu.:28.150   3rd Qu.:1454.28   3rd Qu.: 6.000   3rd Qu.:24.98  
##  Max.   :43.800   Max.   :6488.02   Max.   :10.000   Max.   :25.01  
##    longitude       unit.price    
##  Min.   :121.5   Min.   :  7.60  
##  1st Qu.:121.5   1st Qu.: 27.70  
##  Median :121.5   Median : 38.45  
##  Mean   :121.5   Mean   : 37.98  
##  3rd Qu.:121.5   3rd Qu.: 46.60  
##  Max.   :121.6   Max.   :117.50
# Example data frame structure
library(leaflet)

# Create a leaflet map
map <- leaflet(data = house) %>%
  addTiles()  # You can choose different tilesets with addProviderTiles() if desired

# Add markers to the map based on latitude and longitude
map <- map %>% addMarkers(
  lat = ~latitude,
  lng = ~longitude,
  label = ~unit.price,
  popup = ~paste("Median House Price: $", unit.price),
  clusterOptions = markerClusterOptions()
)

# Display the map
map