create_sentiment_map {DisasterAlert} | R Documentation |
Create Interactive Sentiment Map
Description
This function creates an interactive Leaflet map showing disaster locations colored by sentiment.
Usage
create_sentiment_map(data, lat_col = "Latitude", lon_col = "Longitude")
Arguments
data |
A data.frame with sentiment analysis results |
lat_col |
Name of latitude column (default: "Latitude") |
lon_col |
Name of longitude column (default: "Longitude") |
Value
Leaflet map object
Author(s)
Hossein Hassani and Leila Marvian Mashhad and Nadejda Komendantova.
Examples
sample_data <- data.frame(
City = c("CityA", "CityB", "CityC"),
Longitude = c(10.0, 11.5, 12.2),
Latitude = c(50.1, 49.9, 50.5),
sentiment_score = c( 2.5, -1.0, 0.0),
sentiment_category = c("Positive", "Negative", "Neutral"),
User_Comment = c(
"Amazing rescue efforts!",
"Terrible flooding last night.",
"All calm here."
),
stringsAsFactors = FALSE
)
sentiment_map <- create_sentiment_map(sample_data,
lat_col = "Latitude",
lon_col = "Longitude")
sentiment_map
[Package DisasterAlert version 1.0.0 Index]