column

Exploring Horror Movie Filming Locations Across Countries: 2012-2017

Horror movies released by country from 2012 to 2017

Average horror movie ratings in each country from 2012 to 2017

---
title: "Terror ~ Horror Tales"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
    source_code: embed
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = F)
library(flexdashboard)
library(tidyverse)
library(maps)
library(plotly)
```

```{r load_data}
horror_movies <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-10-22/horror_movies.csv")
```

```{r data_manipulation}
horror <- horror_movies %>% mutate(id = row_number()) %>% 
  separate_rows(genres, sep = "\\| ") %>% 
  mutate(y = 1) %>%
  spread(genres, y, fill = 0)

horror$filming_country <- gsub(".*, ", "", horror$filming_locations)

worldmap <- map_data("world") %>% tbl_df %>% filter(region !="Antarctica")
```

About {.sidebar}
-------------------------------------

My First Tidy Tuesday Flexdashboard: Explored [Horror Movies dataset](https://github.com/rfordatascience/tidytuesday/tree/master/data/2019/2019-10-22) from the IMDB Horror Movie dataset @[Kaggle](https://www.kaggle.com/PromptCloudHQ/imdb-horror-movie-dataset).

My sister-in-law and I always watch horror movies together every time we meet. I went to SLC, Utah in Dec 2023 and we watched Conjuring 3. Hence, I thought this interesting dataset will be the best way to put my freshly learned concepts from Data Visualization Class into practice. 

```{r}
g_film <- horror %>%
  group_by(filming_country) %>%
  summarise(total = n()) %>% 
  top_n(., 5) 

g_film[order(-g_film$total),] %>% knitr::kable()

g1 <- horror %>%
  group_by(release_country) %>%
  summarise(total = n()) %>% 
  top_n(., 5) 

g1[order(-g1$total),] %>% knitr::kable()

g2<-horror %>%
  group_by(release_country) %>%
  summarise(average = mean(review_rating, na.rm = T)) %>% 
  top_n(., 5)

g2[order(-g2$average),] %>% knitr::kable()

```

column
-----------------------------------------------------

### Exploring Horror Movie Filming Locations Across Countries: 2012-2017

```{r}
g_film <- horror %>%
  group_by(filming_country) %>%
  summarise(total = n()) %>%
  right_join(worldmap, by = c("filming_country" = "region")) %>%
  ggplot(aes(long, lat, group = group, fill = total)) +
  geom_polygon(color = "#03045e") +
  scale_fill_gradient(low = "#03045e", high = "#caf0f8", na.value = "#eddcd2") +
  theme(axis.text = element_blank(),
        axis.title = element_blank()) +
  labs(title = "") 

ggplotly(g_film)
```


### Horror movies released by country from 2012 to 2017

```{r}
g_release <- horror %>%
  group_by(release_country) %>%
  summarise(total = n()) %>%
  right_join(worldmap, by = c("release_country" = "region")) %>%
  ggplot(aes(long, lat, group = group, fill = total)) +
  geom_polygon(color = "#143601") +
  scale_fill_gradient(low = "#143601", high = "#a1cca5", na.value = "#eddcd2") +
  theme(axis.text = element_blank(),
        axis.title = element_blank()) +
  labs(title = "") 

ggplotly(g_release)
```


### Average horror movie ratings in each country from 2012 to 2017

```{r}
g_star <- horror %>%
  group_by(release_country) %>%
  summarise(average = mean(review_rating, na.rm = T)) %>%
  right_join(worldmap, by = c("release_country" = "region")) %>%
  ggplot(aes(long, lat, group = group, fill = average)) +
  geom_polygon(color = "#590d22") +
  scale_fill_gradient(low = "#590d22", high = "#ffb3c1", na.value = "#eddcd2") +
  theme(axis.text = element_blank(),
        axis.title = element_blank()) +
  labs(title = "") 

ggplotly(g_star)
```