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-22
Ensure the CSV file is in the same folder as this R Markdown file.
data <- read_csv("buenos-aires-real-estate.csv")
Dataset already uses
latandlon, so no renaming is required.
data_clean <- data %>%
filter(!is.na(lat), !is.na(lon))
leaflet(data_clean) %>%
addProviderTiles(providers$OpenStreetMap) %>%
setView(
lng = mean(data_clean$lon, na.rm = TRUE),
lat = mean(data_clean$lat, na.rm = TRUE),
zoom = 10
) %>%
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"
}
)
)