follow files
data-viz-challenge-3-FatimahAldhamen-main/data-viz-challenge-03.Rmd --- title: "ISTA 320 Data Visualization Challenge 3" author: "ENTER YOUR NAME HERE" date: "Fall 2021" output: html_document --- ```{r setup, include=FALSE} library(knitr) library(tidyverse) opts_chunk$set(echo = TRUE) ``` We will be working with the same flight data that I created the tutorials and demonstration video for this module. We will be working with data from 2009 and 2018. # Read data in There are two data files (`csv` format) inside the data folder in this project. Read both files (using `read_csv()`), and combine them into one data frame (using `bind_rows()`). Mutate the year variable so it is a factor (and not a numerical variable). ```{r} # read data in flight_delays_data_2009 <- ______________="" flight_delays_data_2018="">-><- ______________="" #="" combine="" data="" flight_delay_data_2009_2018="">-><- bind_rows(______________)="" #="" inspect="" data="" glimpse(______________)="" #="" mutate="" year="" so="" year="" is="" a="" factor="" flight_delay_data_2009_2018="">-><- flight_delay_data_2009_2018="" %="">% mutate(______________) ``` # Scatterplots > QUESTION 1: What's the relationship between mean arrival delay time and mean departure delay time? These two variables are in minutes. > QUESTION 2: Is this relationship similar across the two years in the data? To answer these two questions, draw a scatterplot mapping the numerical variables to the axes and the categorical variable to color. ```{r} flight_delay_data_2009_2018 %>% ggplot(______________) + ______________ ``` TYPE YOUR ANSWER TO THE TWO QUESTIONS ABOVE (i.e., your interpretation of the scatterplot you produced) HERE -- REPLACE THIS TEXT WITH YOUR ANSWER For the second part of this data viz challenge, you will be working with the same netflix data from [D2L's Barplots Case Study 1 - Netflix Movies and TV Shows](https://d2l.arizona.edu/d2l/le/content/1064958/viewContent/11083543/View). # Read and inspect the data The data file (in csv format) is inside the `data` folder in this project. Read and inspect the data. ```{r} ``` # Bar plots > Question 1: What is the two most common ratings (i.e., `rating` variable) for the movies and TV shows in this dataset? Suggestions on how to answer this question: 1. draw a barplot (using `geom_bar`) mapping `x` to `rating`. Add another categorical variable to the plot, mapping `fill` to `type`. 2. draw a barplot (using `geom_col`) mapping `x` to `rating`. Add another categorical variable to the plot, mapping `fill` to `type`. Reorder the ratings using `reorder()` I will consider this item done if you draw any of the two (or alternative both) barplots suggested above. ```{r} ``` TYPE YOUR ANSWER TO THE FIRST QUESTION (i.e., your interpretation of the barplot you produced) HERE -- REPLACE THIS TEXT WITH YOUR ANSWER > Question 2: What is the most common duration (in seasons) for TV shows? Suggestion of steps for how to answer this question: 1. Filter the data to keep only `TV Show` for `type`. 2. Draw a barplot (using `geom_bar`) mapping `duration` to one of the axes (either `y` or `x`, whatever you find easier to visualize). 3. Ensure the bars are ordered in a way that makes sense for the `duration` variable (ascending or descending order, from left to right, your choice here) I will consider this item done if implement all three items above. ```{r} ``` TYPE YOUR ANSWER TO THE SECOND QUESTION (i.e., your interpretation of the barplot you produced) HERE -- REPLACE THIS TEXT WITH YOUR ANSWER > Question 3: What is the average duration in minutes of movies across different ratings in the data set. 1. Filter the data to keep only `Movie` for `type`. 1. Mutate duration so it is a number (this step is done for you in the R chunk below) 1. Summarize `mean_duration` by `rating` 1. Draw a barplot (using `geom_col`) `mean_duration` to `y` and `rating` to `x` 1. Order the ratings so that they are in an order that makes it easier to read the plot (hint: not the default alphabetical order) I will consider this item done if implement all items above. ```{r} netflix_movie_data <- replace_this_with_your_dataframe_object_name="" %="">% filter(_____________) %>% mutate(duration = parse_number(duration)) # no need to change this line netflix_movie_data %>% group_by(_____________) %>% summarize(mean_duration = _____________) %>% ggplot(_____________) + _____________ ``` data-viz-challenge-3-FatimahAldhamen-main/data/2009.csv airline,mean_arrival_delay,mean_departure_delay,mean_distance,year 9E,0.9500134288794863,4.031008052779664,412.0308489376152,2009 AA,5.6708979356330085,9.9701829476856485,1052.0493062039511,2009 AS,1.317029800860305,3.5584778547578084,1024.3766162128768,2009 B6,5.079280580811648,9.0451664108106975,1057.3887966414989,2009 CO,5.513818562083278,9.616894418703106,1191.7563602010175,2009 DL,4.841973616257676,7.201473279887569,928.8593096048068,2009 EV,11.720781314309233,12.180766941877406,405.26731467737415,2009 F9,5.685623372866648,6.113162183718054,862.7587876966468,2009 FL,8.197841813846342,9.36324166122439,736.0775221923905,2009 HA,0.26078744933689935,-1.0881489950821703,505.3254721529624,2009 MQ,5.96796750038926,7.853741984822638,418.9363680216483,2009 NW,3.9242081097012393,5.695111839004133,877.3612222638925,2009 OH,10.687756925826632,10.977554126503133,485.92235811931823,2009 OO,3.3035037773063904,5.123137431046899,445.9282163883795,2009 UA,1.034190117198503,8.081000597202069,1111.0839379666486,2009 US,2.0899595546332437,3.4194799993119727,858.7522219573866,2009 WN,1.6638596867624946,8.783072834396206,639.4783988462726,2009 XE,5.754591007003205,6.911216535653108,566.8761436973767,2009 YV,6.04392087934268,8.048537010938864,390.94608583316557,2009 data-viz-challenge-3-FatimahAldhamen-main/data/2018.csv airline,mean_arrival_delay,mean_departure_delay,mean_distance,year 9E,4.4527776720261585,10.670500760147004,475.3693782820314,2018 AA,5.432064851861042,10.035396336291257,1019.9761440912413,2018 AS,-0.5015618633709081,2.4724250063640927,1307.9915870813043,2018 B6,11.432515667085351,15.835463895428866,1072.6260235573075,2018 DL,-0.2898254677449679,7.444506241045512,887.5158280950141,2018 EV,8.800699958796029,12.289559882364873,472.2796065307778,2018 F9,14.213311436910223,19.664290629805528,1034.385312683188,2018 G4,9.98351752248088,12.923752252441018,884.1589594770146,2018 HA,0.8513103448275868,0.9135409054424789,678.02988990452,2018 MQ,5.357279690119756,7.68136227597373,433.55815746497234,2018 NK,5.171453347805361,9.85079195831255,1030.2130462448622,2018 OH,8.23735063058725,11.9720729067809,384.32240881963486,2018 OO,7.044140610623612,10.07741703960698,481.11635737832455,2018 UA,5.764874820097082,10.032101864554653,1184.5733578524378,2018 VX,1.7279776132454965,6.319139061321576,1470.1968439983757,2018 WN,4.519644279965066,11.132819497000996,750.1172807445531,2018 YV,8.853066085110049,11.193251211785809,553.3477443609023,2018 YX,3.0766874582312314,7.3086636818196675,596.1167358410405,2018 data-viz-challenge-3-FatimahAldhamen-main/data/netflix_titles.csv show_id,type,title,director,cast,country,date_added,release_year,rating,duration,listed_in,description s1,TV Show,3%,,"João Miguel, Bianca Comparato, Michel Gomes, Rodolfo Valente, Vaneza Oliveira, Rafael Lozano, Viviane Porto, Mel Fronckowiak, Sergio Mamberti, Zezé Motta, Celso Frateschi",Brazil,"August 14, 2020",2020,TV-MA,4 Seasons,"International TV Shows, TV Dramas, TV Sci-Fi & Fantasy","In a future where the elite inhabit an island paradise far from the crowded slums, you get one chance to join the 3% saved from squalor." s2,Movie,7:19,Jorge Michel Grau,"Demián Bichir, Héctor Bonilla, Oscar Serrano, Azalia Ortiz, Octavio Michel, Carmen Beato",Mexico,"December 23, 2016",2016,TV-MA,93 min,"Dramas, International Movies","After a devastating earthquake hits Mexico City, trapped survivors from all walks of life wait to be rescued while trying desperately to stay alive." s3,Movie,23:59,Gilbert Chan,"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",Singapore,"December 20, 2018",2011,R,78 min,"Horror Movies, International Movies","When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp." s4,Movie,9,Shane Acker,"Elijah Wood, John C. Reilly, Jennifer Connelly, Christopher Plummer, Crispin Glover, Martin Landau, Fred Tatasciore, Alan Oppenheimer, Tom Kane",United States,"November 16, 2017",2009,PG-13,80 min,"Action & Adventure, Independent Movies, Sci-Fi & Fantasy","In a postapocalyptic world, rag-doll robots hide in fear from dangerous machines out to exterminate them, until a brave newcomer joins the group." s5,Movie,21,Robert Luketic,"Jim Sturgess, Kevin Spacey, Kate Bosworth, Aaron Yoo, Liza Lapira, Jacob Pitts, Laurence Fishburne, Jack McGee, Josh Gad, Sam Golzari, Helen Carey, Jack Gilpin",United States,"January 1, 2020",2008,PG-13,123 min,Dramas,A brilliant group of students become card-counting experts with the intent of swindling millions out of Las Vegas casinos by playing blackjack. s6,TV Show,46,Serdar Akar,"Erdal Beşikçioğlu, Yasemin Allen, Melis Birkan, Saygın Soysal, Berkan Şal, Metin Belgin, Ayça Eren, Selin Uludoğan, Özay Fecht, Suna Yıldızoğlu",Turkey,"July 1, 2017",2016,TV-MA,1 Season,"International TV Shows, TV Dramas, TV Mysteries","A genetics professor experiments with a treatment for his comatose sister that blends medical and shamanic cures, but unlocks a shocking side effect." s7,Movie,122,Yasir Al Yasiri,"Amina Khalil, Ahmed Dawood, Tarek Lotfy, Ahmed El Fishawy, Mahmoud Hijazi, Jihane Khalil, Asmaa Galal, Tara Emad",Egypt,"June 1, 2020",2019,TV-MA,95 min,"Horror Movies, International Movies","After an awful accident, a couple admitted to a grisly hospital are separated and must find each other to escape — before death finds them." s8,Movie,187,Kevin Reynolds,"Samuel L. Jackson, John Heard, Kelly Rowan, Clifton Collins Jr., Tony Plana",United States,"November 1, 2019",1997,R,119 min,Dramas,"After one of his high school students attacks him, dedicated teacher Trevor Garfield grows weary of the gang warfare in the New York City school system and moves to California to teach there, thinking it must be a less hostile environment." s9,Movie,706,Shravan Kumar,"Divya Dutta, Atul Kulkarni, Mohan Agashe, Anupam Shyam, Raayo S. Bakhirta, Yashvit Sancheti, Greeva Kansara, Archan Trivedi, Rajiv Pathak",India,"April 1, 2019",2019,TV-14,118 min,"Horror Movies, International Movies","When a doctor goes missing, his psychiatrist wife treats the bizarre medical condition of a psychic patient, who knows much more than he's leading on." s10,Movie,1920,Vikram Bhatt,"Rajneesh Duggal, Adah Sharma, Indraneil Sengupta, Anjori Alagh, Rajendranath Zutshi, Vipin Sharma, Amin Hajee, Shri Vallabh Vyas",India,"December 15, 2017",2008,TV-MA,143 min,"Horror Movies, International Movies, Thrillers",An architect and his wife move into a castle that is slated to become a luxury hotel. But something inside is determined to stop the renovation. s11,Movie,1922,Zak Hilditch,"Thomas Jane, Molly Parker, Dylan Schmid, Kaitlyn Bernard, Bob Frazer, Brian d'Arcy James, Neal McDonough",United States,"October 20, 2017",2017,TV-MA,103 min,"Dramas, Thrillers","A farmer pens a confession admitting to his wife's murder, but her death is just the beginning of a macabre tale. Based on Stephen King's novella." s12,TV Show,1983,,"Robert Więckiewicz, Maciej Musiał, Michalina Olszańska, Andrzej Chyra, Clive Russell, Zofia Wichłacz, Edyta Olszówka, Mateusz Kościukiewicz, Ewa Błaszczyk, Vu Le Hong, Tomasz Włosok, Krzysztof Wach","Poland, United States","November 30, 2018",2018,TV-MA,1 Season,"Crime TV Shows, International TV Shows, TV Dramas","In this dark alt-history thriller, a naïve law student and a world-weary detective uncover a conspiracy that has tyrannized Poland for decades." s13,TV Show,1994,Diego Enrique Osorno,,Mexico,"May 17, 2019",2019,TV-MA,1 Season,"Crime TV Shows, Docuseries, International TV Shows","Archival video and new interviews examine Mexican politics in 1994->->