How has labor productivity in different sectors evolved over the years?

Key Insights

1. Average labor productivity (Real) over the years

# Summarize the data for real labor productivity
real_productivity_summary <- global_prod %>%
  group_by(year) %>%
  summarize(
    avg_labor_productivity_real = mean(Labor_productivity_real, na.rm = TRUE)
  )

# Display the summarized data
real_productivity_summary
## # A tibble: 68 × 2
##     year avg_labor_productivity_real
##    <dbl>                       <dbl>
##  1  1950                       7567.
##  2  1951                       8310.
##  3  1952                       7470.
##  4  1953                       7851.
##  5  1954                       8338.
##  6  1955                       8502.
##  7  1956                       8399.
##  8  1957                       8551.
##  9  1958                       8875.
## 10  1959                       9088.
## # ℹ 58 more rows

2. Average labor productivity (PPP) over the years

# Summarize the data for PPP labor productivity
ppp_productivity_summary <- global_prod %>%
  group_by(year) %>%
  summarize(
    avg_labor_productivity_PPP = mean(Labor_productivity_PPP, na.rm = TRUE)
  )

# Display the summarized data
ppp_productivity_summary
## # A tibble: 68 × 2
##     year avg_labor_productivity_PPP
##    <dbl>                      <dbl>
##  1  1950                       31.5
##  2  1951                       32.6
##  3  1952                       30.6
##  4  1953                       31.1
##  5  1954                       32.3
##  6  1955                       33.0
##  7  1956                       33.3
##  8  1957                       34.2
##  9  1958                       34.3
## 10  1959                       34.6
## # ℹ 58 more rows

Visualization

1. Visualization of average labor productivity (Real) over the years

ggplot(real_productivity_summary, aes(x = year, y = avg_labor_productivity_real)) +
  geom_line() +
  geom_point() +
  labs(
    title = "Average labor productivity (Real) over the years",
    x = "Year",
    y = "Average labor productivity (Real)"
  ) +
  theme_minimal()

2. Visualization of labor productivity (Real) over the years by sector

# Assuming your data is in a data frame called 'data'
# Filter out the 'Total' sector
filtered_global_prod <- global_prod %>%
  filter(sector != "Total")

# Create the stacked bar chart
ggplot(filtered_global_prod, aes(x = year, y = Labor_productivity_real, fill = sector)) +
  geom_bar(stat = "identity") +
  labs(
    title = "Labor productivity (Real) by sector over the years",
    x = "Year",
    y = "Labor productivity (Real)"
  ) +
  theme_minimal()
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_bar()`).