This webpage presents an interactive map of real estate listings in Buenos Aires using the Leaflet library in R.
Dataset source: Kaggle Buenos Aires Real Estate dataset.
Created on: 2026-04-20
Ensure the CSV file is in the same folder as this R Markdown file.
data <- read_csv("buenos-aires-real-estate.csv")
glimpse(data)
## Rows: 146,660
## Columns: 19
## $ start_date <date> 2019-10-17, 2019-10-17, 2019-10-17, 2019-10-17, 2019-…
## $ end_date <date> 2019-12-23, 2019-11-21, 2019-11-01, 2019-12-23, 2020-…
## $ created_on <date> 2019-10-17, 2019-10-17, 2019-10-17, 2019-10-17, 2019-…
## $ lat <dbl> -34.60588, -34.62406, -34.59357, -34.58129, -34.91419,…
## $ lon <dbl> -58.38495, -58.41211, -58.42747, -58.43675, -57.93822,…
## $ l1 <chr> "Argentina", "Argentina", "Argentina", "Argentina", "A…
## $ l2 <chr> "Capital Federal", "Capital Federal", "Capital Federal…
## $ l3 <chr> "San Cristobal", "Boedo", "Palermo", "Palermo", "La Pl…
## $ rooms <dbl> 7, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, …
## $ bedrooms <dbl> 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ bathrooms <dbl> 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, …
## $ surface_total <dbl> 140, 70, 45, 85, 50, 56, 70, 70, 45, 45, 66, 68, 50, 5…
## $ surface_covered <dbl> 140, 58, 45, 50, 35, 56, 70, 70, 37, 37, 49, 59, 44, 3…
## $ price <dbl> 153000, 159000, 125000, 295000, 40000, 150000, 159500,…
## $ currency <chr> "USD", "USD", "USD", "USD", "USD", "USD", "USD", "USD"…
## $ title <chr> "***Venta semipiso centro, ideal hostel*****", "Espect…
## $ description <chr> "DESCRIPCION DE LA PROPIEDAD: Departamento de 140,65 m…
## $ property_type <chr> "Departamento", "PH", "PH", "PH", "PH", "PH", "PH", "P…
## $ operation_type <chr> "Venta", "Venta", "Venta", "Venta", "Venta", "Venta", …
Dataset already uses
latandlon, so no renaming is required.
data_clean <- data %>%
filter(!is.na(lat), !is.na(lon))
summary(data_clean)
## start_date end_date created_on
## Min. :2019-01-01 Min. :2019-01-04 Min. :2019-01-01
## 1st Qu.:2019-04-30 1st Qu.:2019-06-30 1st Qu.:2019-04-30
## Median :2019-08-01 Median :2019-09-14 Median :2019-08-01
## Mean :2019-08-03 Mean :3386-09-16 Mean :2019-08-03
## 3rd Qu.:2019-11-13 3rd Qu.:2020-01-21 3rd Qu.:2019-11-13
## Max. :2020-01-25 Max. :9999-12-31 Max. :2020-01-25
##
## lat lon l1 l2
## Min. :-35.32 Min. :-180.00 Length:136701 Length:136701
## 1st Qu.:-34.63 1st Qu.: -58.50 Class :character Class :character
## Median :-34.60 Median : -58.44 Mode :character Mode :character
## Mean :-34.60 Mean : -58.47
## 3rd Qu.:-34.57 3rd Qu.: -58.41
## Max. : 85.05 Max. : -57.81
##
## l3 rooms bedrooms bathrooms
## Length:136701 Min. : 1.00 Min. : 0.000 Min. : 1.000
## Class :character 1st Qu.: 2.00 1st Qu.: 1.000 1st Qu.: 1.000
## Mode :character Median : 3.00 Median : 2.000 Median : 1.000
## Mean : 3.08 Mean : 1.982 Mean : 1.581
## 3rd Qu.: 4.00 3rd Qu.: 3.000 3rd Qu.: 2.000
## Max. :35.00 Max. :15.000 Max. :14.000
## NA's :5366
## surface_total surface_covered price currency
## Min. : 10.0 Min. : 1.0 Min. : 5500 Length:136701
## 1st Qu.: 52.0 1st Qu.: 46.0 1st Qu.: 110000 Class :character
## Median : 78.0 Median : 67.0 Median : 165000 Mode :character
## Mean : 216.8 Mean : 111.8 Mean : 235741
## 3rd Qu.: 140.0 3rd Qu.: 107.0 3rd Qu.: 260000
## Max. :193549.0 Max. :126062.0 Max. :32434232
## NA's :19122 NA's :20142
## title description property_type operation_type
## Length:136701 Length:136701 Length:136701 Length:136701
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
leaflet(data_clean) %>%
addProviderTiles(providers$OpenStreetMap) %>%
addCircleMarkers(
lng = ~lon,
lat = ~lat,
radius = 5,
stroke = FALSE,
fillOpacity = 0.7,
popup = ~paste0(
"<b>Price:</b> ",
if ("price" %in% names(data_clean)) {
ifelse(is.na(price), "N/A", price)
} else {
"N/A"
},
"<br>",
"<b>Property Type:</b> ",
if ("property_type" %in% names(data_clean)) {
ifelse(is.na(property_type), "N/A", property_type)
} else {
"N/A"
}
)
)