---
title: "Why bagyo?"
author: "Ernest Guevarra"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Why bagyo?}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE,
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup, echo = FALSE}
library(bagyo)
```

One would be hard-pressed to think of any other event or phenomenon more universally experienced by Filipinos than a cyclone or what we Filipinos call ***bagyo*** (pronounced /baɡˈjo/, [bɐɡˈjo]). My earliest memory related to cyclones was when I was 4 years old and my older brother and I were put into an empty plastic drum to float above flood waters pushed along by our mother. My mother recounts how happy and excited my brother and I was being inside that drum, oblivious to the strong gusts of wind and heavy rains outside. She did her best to steady the drum and shield us from the wind and rain while she waded through chest-deep flood waters to get to a place of refuge. As I grew up, cyclones would provide interesting chapters into my formative years. I still recall the joy of having school cancelled when the incoming cyclone was determined to be too strong and potentially unsafe followed by an immediate realisation that I would just end up being stuck at home and unable to play because of the harsh conditions outside and the constant possibility of flooding. In my second year of medical school, I volunteered to live in a small remote fishing village in the main northern island of the Philippines. The village lies along the usual path of cyclones that develop on the Philippine Sea to the east. As to be expected, midway into my time there was when I experienced the raw power of cyclones. Over a three-day period, two typhoon category cyclones made landfall near the area of the fishing village and with the eye of the storm, the spot with the lowest pressure and fastest sustained wind speed, passing very close by. This was very transformative and made the experiences of those in the margins - whether physical, social, or economical - tangible and real for me.

Now, having lived almost half of my lifetime outside of the Philippines, I have gone places where I've experienced other life-changing and values-defining events and phenomenon. These, along with my cyclones experience, continue to shape and inform my notion and understanding of fairness, diversity, and equity.

It is from this background that this R package was borne out of. Just like a songwriter's lyrics and melody for a loved one or a poet's ode to their muse, this package is a nod to my youth and a loving embrace to my motherland. I've always thought of how good it would be to have a dataset that I, and others like me, will be able to relate to. I hope this dataset can be an adjunct to the well-established [`iris`](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/iris.html) dataset and to the currently popular [`palmerpenguins`](https://allisonhorst.github.io/palmerpenguins/) dataset.

## About the `bagyo` data

The `bagyo` package contains the `bagyo` dataset. This dataset was taken from annual reports on Philippine tropical cyclones prepared and released by [PAGASA](https://www.pagasa.dost.gov.ph/) at its [website](https://www.pagasa.dost.gov.ph/tropical-cyclone/publications/annual-report) in PDF format.

Because the reports are in PDF format and the information described above are in tables within the documents, scripts for scraping the desired data were developed and implemented to arrive at the `bagyo` dataset. The data scraping script can be viewed [here](https://github.com/panukatan/bagyo/blob/main/data-raw/process_data.R).

The following information is available from the dataset:

**Variable** | **Description** 
:--- | :--- 
*year* | Year 
*category_code* | Tropical cyclone category code
*category_name* | Tropical cyclone category name
*name* | Name given to the tropical cyclone by Philippine authorities
*rsmc_name* | Name given to the tropical cyclone by the Regional Specialized Meteorological Centre (RSMC)
*start* | Date and time at which cyclone enters Philippine area of responsibility (PAR)
*end* | Date and time at which cyclone leaves Philippine area of responsibility (PAR)
*pressure* | Maximum central pressure in *hPa*
*speed* | Maximum sustained wind speed in *km/h*

This metadata can be viewed in R through a call to `?bagyo` in the R console.

Whilst tropical cyclones have affected the Philippines far earlier than 2017 and more currently than 2022, official and publicly available data for the information described above is only available in the reports for years 2017 to 2020. Earlier documents of this annual reporting pre-2017 have been produced but are not available on the [PAGASA](https://www.pagasa.dost.gov.ph/) website. These reports of the tropical cyclone season (re-started in 2019) are published within two years after the termination of the season. Hence, the most recent report is only up to 2022 for now.

It is expected that reports for 2023 onwards will continue to be published and made available by PAGASA. As such, the `bagyo` package and the `bagyo` dataset within it will be updated accordingly. Continued efforts are also being taken to find sources of information for years preceding 2017.

<br>
<br>
