dat <- read_csv("C:/Users/Dell/Desktop/Capstone/Dataset/tech_layoffs_hiring_trends_elite_v2.csv")

glimpse(dat)
## Rows: 12,000
## Columns: 23
## $ record_id              <chr> "T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7",…
## $ company_name           <chr> "Microsoft", "Palantir", "Anthropic", "Spotify"…
## $ industry               <chr> "AI", "AI", "Cybersecurity", "Gaming", "Gaming"…
## $ country                <chr> "Singapore", "Canada", "USA", "USA", "UK", "USA…
## $ company_size           <chr> "Enterprise", "Big Tech", "Mid-size", "Mid-size…
## $ month                  <chr> "Mar", "Feb", "Apr", "Jun", "Feb", "Jul", "Dec"…
## $ year                   <dbl> 2026, 2024, 2025, 2025, 2025, 2024, 2024, 2025,…
## $ layoffs_count          <dbl> 860, 955, 18912, 18159, 815, 3568, 3454, 1038, …
## $ layoff_percentage      <dbl> 1.8, 1.8, 9.5, 9.1, 3.3, 32.7, 29.4, 1.1, 9.3, …
## $ reason_for_layoffs     <chr> "AI Automation", "Cost Cutting", "Overhiring Co…
## $ ai_automation_impact   <dbl> 6.4, 0.9, 7.1, 10.4, 11.4, 0.9, 6.7, 6.2, 9.5, …
## $ ai_replacement_risk    <dbl> 5.0, 1.1, 3.9, 7.4, 10.0, 8.4, 10.0, 5.8, 10.0,…
## $ open_roles             <dbl> 5426, 9666, 437, 1075, 537, 642, 1620, 763, 534…
## $ hiring_trend           <chr> "Moderate Hiring", "Moderate Hiring", "Hiring F…
## $ remote_jobs_percentage <dbl> 46.7, 58.9, 85.4, 44.0, 53.2, 66.9, 47.8, 55.1,…
## $ top_hiring_role        <chr> "ML Engineer", "ML Engineer", "Frontend Develop…
## $ stock_growth_percent   <dbl> -25.7, -5.6, 7.0, 31.6, 85.3, 36.8, 51.3, -26.2…
## $ revenue_growth_percent <dbl> 30.3, 6.1, -23.6, -22.3, 26.6, 53.7, 39.7, 26.4…
## $ salary_budget_change   <dbl> 4.9, 1.5, -14.9, -1.6, 9.8, 15.2, 10.8, 13.9, -…
## $ ai_adoption_level      <dbl> 4.4, 1.0, 5.6, 6.5, 9.3, 1.1, 5.0, 5.7, 6.4, 3.…
## $ employee_sentiment     <dbl> 8.7, 8.2, 4.5, 5.4, 6.7, 7.7, 6.9, 6.5, 5.8, 5.…
## $ job_security_score     <dbl> 8.6, 7.2, 5.9, 4.7, 5.8, 5.4, 4.2, 8.4, 6.0, 6.…
## $ market_condition       <chr> "Bull Market", "Bull Market", "Recession", "Rec…

The State of Tech Layoffs

Layoffs by Industry

This visualization shows the total number of layoffs across different technology industries. It helps identify which sectors have been most affected by workforce reductions.

industry_layoffs <- dat %>%
  group_by(industry) %>%
  summarise(
    total_layoffs = sum(layoffs_count, na.rm = TRUE)
  ) %>%
  arrange(desc(total_layoffs))

ggplot(industry_layoffs,
       aes(x = reorder(industry, total_layoffs),
           y = total_layoffs)) +

  geom_col(fill = "steelblue") +

  coord_flip() +

  labs(
    title = "Total Layoffs by Industry",
    subtitle = "Technology sectors ranked by workforce reductions",
    x = "Industry",
    y = "Number of Employees Laid Off"
  ) +

  theme_minimal()

AI Adoption and Workforce Reductions

This scatter plot explores the relationship between AI adoption levels and workforce reductions. It helps determine whether companies with higher AI adoption levels tend to report larger layoff percentages.

ggplot(dat,
       aes(x = ai_adoption_level,
           y = layoff_percentage)) +

  geom_point(
    alpha = 0.6,
    color = "steelblue"
  ) +

  geom_smooth(
    method = "lm",
    se = FALSE,
    color = "red"
  ) +

  labs(
    title = "AI Adoption vs Layoff Percentage",
    subtitle = "Relationship between AI implementation and workforce reductions",
    x = "AI Adoption Level",
    y = "Layoff Percentage"
  ) +

  theme_minimal()

Employee Sentiment Across Market Conditions

This box plot compares employee sentiment across different market conditions. It helps identify whether employee morale varies depending on the economic environment.

ggplot(dat,
       aes(x = market_condition,
           y = employee_sentiment,
           fill = market_condition)) +

  geom_boxplot(alpha = 0.8) +

  labs(
    title = "Employee Sentiment by Market Condition",
    subtitle = "Distribution of employee sentiment across economic conditions",
    x = "Market Condition",
    y = "Employee Sentiment Score"
  ) +

  theme_minimal() +

  theme(
    legend.position = "none"
  )

Industry Performance Across Market Conditions

This heatmap displays the average number of layoffs across industries and market conditions. Darker colors indicate higher average layoffs, helping identify sectors that are most vulnerable under different economic environments.

industry_market <- dat %>%
  group_by(industry, market_condition) %>%
  summarise(
    avg_layoffs = mean(layoffs_count, na.rm = TRUE),
    .groups = "drop"
  )
ggplot(industry_market,
       aes(x = market_condition,
           y = industry,
           fill = avg_layoffs)) +

  geom_tile(color = "white", linewidth = 0.5) +

  geom_text(
    aes(label = round(avg_layoffs, 0)),
    size = 3
  ) +

  scale_fill_gradient(
    low = "#D6EAF8",
    high = "#1B4F72"
  ) +

  labs(
    title = "Average Layoffs by Industry and Market Condition",
    subtitle = "Higher values indicate industries experiencing larger workforce reductions",
    x = "Market Condition",
    y = "Industry",
    fill = "Avg Layoffs"
  ) +

  theme_minimal() +

  theme(
    plot.title = element_text(
      size = 16,
      face = "bold"
    ),
    plot.subtitle = element_text(
      size = 11
    ),
    axis.text.x = element_text(
      angle = 20,
      hjust = 1
    )
  )

Job Security Across Company Sizes

This violin plot illustrates the distribution of job security scores across different company sizes. It highlights both the spread and concentration of employee perceptions regarding job stability.

ggplot(dat,
       aes(x = company_size,
           y = job_security_score,
           fill = company_size)) +

  geom_violin(
    alpha = 0.7,
    trim = FALSE
  ) +

  geom_boxplot(
    width = 0.1,
    fill = "white",
    outlier.shape = NA
  ) +

  stat_summary(
    fun = mean,
    geom = "point",
    shape = 23,
    size = 3,
    fill = "black"
  ) +

  labs(
    title = "Job Security Score by Company Size",
    subtitle = "Distribution, median, and average job security perceptions",
    x = "Company Size",
    y = "Job Security Score"
  ) +

  theme_minimal() +

  theme(
    legend.position = "none",
    plot.title = element_text(
      face = "bold",
      size = 16
    )
  )

Financial Performance and Market Response

This bubble chart examines the relationship between revenue growth and stock growth. Bubble size represents the number of open roles, allowing us to explore whether growing companies continue to expand their workforce.

ggplot(dat,
       aes(x = revenue_growth_percent,
           y = stock_growth_percent,
           size = open_roles,
           color = company_size)) +

  geom_point(
    alpha = 0.6
  ) +
  
    
  labs(
    title = "Revenue Growth vs Stock Growth",
    subtitle = "Bubble size indicates the number of open positions",
    x = "Revenue Growth (%)",
    y = "Stock Growth (%)",
    size = "Open Roles",
    color = "Company Size"
  ) +

  theme_minimal()

Interactive Exploration of AI Adoption and Hiring

This interactive scatter plot explores the relationship between AI adoption levels and the number of open roles. Users can hover over individual points to view company-specific information.

plot_ly(
  data = dat,
  x = ~ai_adoption_level,
  y = ~open_roles,
  color = ~company_size,
  text = ~paste(
    "Company:", company_name,
    "<br>Industry:", industry,
    "<br>Open Roles:", open_roles,
    "<br>AI Adoption:", ai_adoption_level
  ),
  type = "scatter",
  mode = "markers"
) %>%

layout(
  title = "AI Adoption Level vs Open Roles",
  xaxis = list(title = "AI Adoption Level"),
  yaxis = list(title = "Number of Open Roles")
)

Conclusion

This analysis explored workforce trends across the technology sector, focusing on layoffs, hiring patterns, AI adoption, employee sentiment, and financial performance. The findings suggest that AI adoption, market conditions, and company characteristics all play a role in shaping workforce outcomes. While some industries experienced significant layoffs, others continued hiring and expanding, highlighting the complex relationship between technological advancement and employment trends.