Module # 10 assignment

Issaiah. Jennings 

Module # 10 assignment

For this project, I used the economics dataset in R to analyze unemployment trends from 2000 to 2008 using ggplot2. First, I added a year column to make it easier to categorize the data by time. I then created a line plot to visualize the unemployment rate over time, providing a clear look at how the number of unemployed individuals changed each month. Next, I generated another line plot to examine the median duration of unemployment, highlighting periods when people stayed unemployed longer. Finally, I created a scatter plot with paths to compare the unemployment rate and median duration, using color to distinguish different years.



Visualizing time series data with ggplot2 helped uncover trends and patterns that might not be as obvious in raw numbers. The line plots made it easy to track changes over time, while the scatter plot provided insights into the relationship between unemployment and duration. Customizing the colors and layout improved clarity and made the information easier to interpret. This exercise reinforced how effective visualizations can simplify complex data and make trends more apparent in time series analysis.

> library(ggplot2)

> library(dplyr)

> data("economics")  # Load the economics dataset

> # Adding a year column

> economics$year <- as.POSIXlt(economics$date)$year + 1900

> economics_filtered <- economics %>%

+   filter(date >= as.Date("2000-01-01") & date <= as.Date("2008-12-31"))

> # 1. Line plot of Unemployment Rate

> ggplot(economics_filtered, aes(x = date, y = unemploy / pop)) +

+   geom_line(color = "darkblue") +

+   labs(title = "Unemployment Rate Over Time (2000-2008)",

+        x = "Year", y = "Unemployment Rate") +

+   theme_minimal()

> # 2. Line plot of Median Unemployment Duration

> ggplot(economics_filtered, aes(x = date, y = uempmed)) +

+   geom_line(color = "darkgreen") +

+   labs(title = "Median Unemployment Duration (2000-2008)",

+        x = "Year", y = "Median Unemployment Duration (weeks)") +

+   theme_minimal()

> # 3. Scatter plot of Unemployment vs. Duration with Year Coloring

> ggplot(economics_filtered, aes(x = unemploy / pop, y = uempmed, color = factor(year))) +

+   geom_point() +

+   geom_path() +

+   labs(title = "Unemployment vs. Duration (2000-2008)",

+        x = "Unemployment Rate", y = "Median Unemployment Duration (weeks)", color = "Year") +

+   theme_minimal()










Comments

Popular posts from this blog

Final project in this class Spring 2025

Module # 5 assignment

Assignment # 4: Time Series Visualization Using Tableau Public