Introduction

This report shows a visual representation of the path of typhoon Haiyan as it passed through the Philippine Area of Responsibility and neighboring countries. The data was taken from the United Nations Office for the Coordination of Humanitarian Affairs office (OCHA) in the Philippines.

Visualization

Loading the required packages

library(leaflet)
library(RColorBrewer)
library(foreign)

Next, we prepare the data. The original file can be downloaded in dbf format among other formats. To read this, we use the read.dbf function from the foreign package. We then separate the latitude and longitude details from the main data frame.

yolandaPath <- read.dbf("Typhoon_Yolanda_Path.dbf", as.is = FALSE)
my_map <- cbind(yolandaPath$LAT,yolandaPath$LONG)
colnames(my_map)<- c("lat","lng")
head(my_map)
##        lat lng
## [1,] 156.0 6.4
## [2,] 154.3 6.4
## [3,] 152.7 6.4
## [4,] 151.6 6.0
## [5,] 151.6 6.0
## [6,] 150.2 6.0

Additionally, we want to color code and have the map weights based on the typhoon category. There are 7 typhoon categories in the dataset.

levels(yolandaPath$CATEGORY)
## [1] "Category 1"          "Category 2"          "Category 3"         
## [4] "Category 4"          "Category 5"          "Tropical depression"
## [7] "Tropical storm"

So we create another dataset wherein we take these levels and convert them to numeric to be used as radius and assign a color per level. The brewer.pal function from RColorBrewer was used to generate a list of colors from yellow to red depending on the levels we have under category.

myCategory <- yolandaPath$CATEGORY
myCategory <- as.data.frame(myCategory)
myCategory$cat <- yolandaPath$CATEGORY
levels(myCategory$cat) <- c(3,4,5,6,7,1,2)
myCategory$cat<- as.numeric(paste(myCategory$cat))
myCategory$col <- as.factor(myCategory$cat)
levels(myCategory$col) <- brewer.pal(7,"YlOrRd")
head(myCategory)
##            myCategory cat     col
## 1 Tropical depression   1 #FFFFB2
## 2 Tropical depression   1 #FFFFB2
## 3 Tropical depression   1 #FFFFB2
## 4      Tropical storm   2 #FED976
## 5      Tropical storm   2 #FED976
## 6      Tropical storm   2 #FED976

Finally, using the leaflet package, we create this interactive map that shows the path of the typhoon Haiyan locally known as “Yolanda” together with the typhoon tagging at the time it crossed specific points in the map.

my_map %>%
  leaflet() %>%
  addTiles() %>%
  addCircles(weight = 1, radius = myCategory$cat*50000,
             color = myCategory$col) %>%
  addLegend(position = "topright",
            labels = c("Tropical depression","Tropical storm","Category 1","Category 2","Category 3","Category 4","Category 5"),
            colors = levels(myCategory$col))