Chicago Bird Collisions with Bootstraps

The datasets analyzed in this blog post are from TidyTuesday Project about bird collision in Chicago. Through analyzing these datasets, hopefully we will gain a better understanding on bird collision in general and this blog post will shed some light on how to reduce bird collisions. Read more

Tennis Grand Slam Visualization & Winning Tournament Prediction

The datasets in this blog post are about 4 Tennis Grand Slams and their winners across various decades since 1968 from TidyTuesday. library(tidyverse) library(tidytext) timeline <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-04-09/grand_slam_timeline.csv") grand_slams <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-04-09/grand_slams.csv") %>% mutate(grand_slam = str_replace(grand_slam, "_", " "), grand_slam = str_to_title(grand_slam)) %>% mutate(grand_slam = fct_recode(grand_slam, "US Open" = "Us Open")) player_dob <- read_csv("https://raw. Read more

Seattle Bike Traffic Visualization with Functional Programming

This post analyzes the Seattle bike traffic dataset, which is interesting to visualize. It comes from TidyTuesday. Load the packages and dataset with a few data processing steps. library(tidyverse) library(lubridate) library(tidytext) theme_set(theme_bw()) bike <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-04-02/bike_traffic.csv") %>% mutate(date = mdy_hms(date), year = year(date), month = month(date), day = day(date), hour = hour(date), weekday = wday(date, label = T, abbr = T, week_start = 1)) %>% filter(bike_count < 1000) %>% mutate(peak_hour = ifelse(hour > 7 & hour < 18, "Peak Hours", "Not Peak Hours")) bike ## # A tibble: 509,082 x 11 ## date crossing direction bike_count ped_count year month day ## <dttm> <chr> <chr> <dbl> <lgl> <dbl> <dbl> <int> ## 1 2014-01-01 00:00:00 Broadwa~ North 0 NA 2014 1 1 ## 2 2014-01-01 01:00:00 Broadwa~ North 3 NA 2014 1 1 ## 3 2014-01-01 02:00:00 Broadwa~ North 0 NA 2014 1 1 ## 4 2014-01-01 03:00:00 Broadwa~ North 0 NA 2014 1 1 ## 5 2014-01-01 04:00:00 Broadwa~ North 0 NA 2014 1 1 ## 6 2014-01-01 05:00:00 Broadwa~ North 0 NA 2014 1 1 ## 7 2014-01-01 06:00:00 Broadwa~ North 0 NA 2014 1 1 ## 8 2014-01-01 07:00:00 Broadwa~ North 0 NA 2014 1 1 ## 9 2014-01-01 08:00:00 Broadwa~ North 2 NA 2014 1 1 ## 10 2014-01-01 09:00:00 Broadwa~ North 0 NA 2014 1 1 ## # . Read more

Hypergeometric Testing on Seattle Pets

The dataset of this blog post comes from TidyTuesday about pet names and the related information. This is a relatively simple dataset that does not have too many columns to explore, but I will analyze the dataset by using hypergeometric testing. First, load the packages and the dataset with a few cleaning steps. Read more

Women in the Workforce Data Visualization

The three datasets this post analyzes come from TidyTuesday. library(tidyverse) library(scales) library(tidytext) jobs_gender <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/jobs_gender.csv") earnings_female <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/earnings_female.csv") employed_gender <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-05/employed_gender.csv") Female salary percent of male salary earnings_female %>% mutate(group = str_replace(group, " years", "")) %>% mutate(group = str_remove(group, ", .+"), group = fct_reorder(group, -percent, sum)) %>% #filter(group ! Read more

Board Games Visualization & Lasso Analysis

This blog post is about visualizing and analyzing the board games dataset from R for Data Science online community TidyTuesday. Load the packages and the dataset with some processing. library(tidyverse) library(tidytext) library(glmnet) library(Matrix) library(broom) board_games <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-12/board_games.csv") %>% filter(playing_time < 500)%>% mutate(decade = 10 * floor(year_published/10)) board_games ## # A tibble: 10,466 x 23 ## game_id description image max_players max_playtime min_age min_players ## <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> ## 1 1 Die Macher is a~ //cf. Read more

French Train Data Processing & Visualization

The dataset of this blog post analyzes comes from TidyTuesday about train schedule delays in France across various stations. Load the packages and the dataset. library(tidyverse) library(lubridate) library(tidytext) library(scales) library(ggpmisc) trains <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-02-26/full_trains.csv") %>% mutate(departure_station = str_to_title(departure_station), arrival_station = str_to_title(arrival_station), date = make_date(year,month)) trains ## # A tibble: 5,462 x 28 ## year month service departure_station arrival_station journey_time_avg ## <dbl> <dbl> <chr> <chr> <chr> <dbl> ## 1 2017 9 National Paris Est Metz 85. Read more

U.S. PhD Data Analysis with Extensive Data Cleaning/Processing

The data context of this blog post is interesting, as it is about PhD graduates in the U.S. from various years. As a Ph.D. student majoring in Data Science, this is revelant to me, although Data Science is not shown in the datasets. The clean dataset is from TidyTuesday, and later I will use the raw datasets from NSF to carry out extensive data cleaning, which can shed some light on data preprocessing steps from the EXCEL files. Read more

Analyzing US Dairy Consumption with Time Series Prediction (sweep package used)

The 5 dairy-related datasets in this blog post we analyze are from TidyTuesday. library(tidyverse) library(lubridate) library(sweep) library(timetk) library(forecast) milk_products_facts <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/milk_products_facts.csv") cheese <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/clean_cheese.csv") milk_sales <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/fluid_milk_sales.csv") cows <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/milkcow_facts.csv") state_milk <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-29/state_milk_production.csv") Check data quality skimr::skim(milk_products_facts) Table 1: Data summary Name milk_products_facts Number of rows 43 Number of columns 18 _______________________ Column type frequency: numeric 18 ________________________ Group variables None Variable type: numeric Read more

U.S. Incarceration Data Visualization Analysis with Functional Programming

The datasets of this blog posts are from TidyTuesday about prison and pretrial in the U.S. in the last several decades. library(tidyverse) library(patchwork) library(scales) library(tidytext) library(geofacet) theme_set(theme_light()) Prison Summary First off, let’s analyze the overall prison summary. prison_summary <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-01-22/prison_summary.csv") prison_summary ## # A tibble: 1,000 x 4 ## year urbanicity pop_category rate_per_100000 ## <dbl> <chr> <chr> <dbl> ## 1 1983 rural Black 1117. Read more