Canadian Farm Operators
Graphs on Canadian farm operator demographics using STATCAN data
Prepare Data
# Prep data
myCaption = "www.dblogr.com/ or derekmichaelwright.github.io/dblogr/ | Data: STATCAN"
myColors_Years <- alpha("darkgreen", seq(0.1, 0.7, by = 0.1))
myColors_Sex <- c("steelblue", "palevioletred3")
myColors_Age <- c("darkgreen","steelblue","darkred")
myAreas <- c("Canada", "British Columbia", "Alberta", "Saskatchewan",
"Manitoba", "Ontario", "Quebec", "New Brunswick", "Nova Scotia",
"Prince Edward Island", "Newfoundland and Labrador",
"Yukon", "Nunavut", "Northwest Territories",
"Northwest Territories including Nunavut",
"Unknown province or territory")
dd <- agData_STATCAN_Farmers #%>%
#mutate(Area = factor(Area, levels = myAreas))
pp <- agData_STATCAN_Population %>%
group_by(Area, Year) %>%
summarise(Population = mean(Value, na.rm = T))
Canada
# Prep data
xx <- dd %>%
filter(Area == "Canada") %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, fill = Year)) +
geom_col(color = "black") +
facet_wrap(Measurement ~ ., scales = "free_y") +
scale_fill_manual(name = NULL, values = myColors_Years) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Canadian Farm Operator Demographics",
x = NULL, y = "Thousand", caption = myCaption)
ggsave("farmers_canada_1_01.png", mp, width = 9, height = 5)
Total Number of Farm Operators
Canada
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement == "Total number of operators") %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Area, y = Value / 1000, fill = Year)) +
geom_col(position = "dodge", color = "black") +
scale_fill_manual(name = NULL, values = myColors_Years) +
theme_agData(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total Number of Farm Operators",
y = "Thousand Operators", x = NULL, caption = myCaption)
ggsave("farmers_canada_1_02.png", mp, width = 6, height = 4)
Provinces
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement == "Total number of operators") %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, fill = Year)) +
geom_col(color = "black") +
facet_wrap(Area ~ ., scales = "free_y", ncol = 5) +
scale_fill_manual(name = NULL, values = myColors_Years) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total Number of Farm Operators",
y = "Thousand Operators", x = NULL, caption = myCaption)
ggsave("farmers_canada_1_03.png", mp, width = 10, height = 5)
Percent of Population
Provinces
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement == "Total number of operators") %>%
left_join(pp, by = c("Year", "Area")) %>%
mutate(Year = factor(Year),
Rate = 100 * Value / Population)
# Plot
mp <- ggplot(xx, aes(x = Year, y = Rate, fill = Year)) +
geom_col(color = "black") +
facet_wrap(Area ~ ., ncol = 5) +
scale_fill_manual(name = NULL, values = myColors_Years) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total Number of Farm Operators",
y = "Percent of Population", x = NULL, caption = myCaption)
ggsave("farmers_canada_1_04.png", mp, width = 10, height = 5)
Percent of Population
2021
# Prep data
xx <- dd %>%
filter(Year == 2021, Measurement == "Total number of operators") %>%
left_join(pp, by = c("Year", "Area")) %>%
mutate(Rate = 100 * Value / Population) %>%
arrange(desc(Rate)) %>%
mutate(Area = factor(Area, levels = unique(.$Area)))
# Plot
mp <- ggplot(xx, aes(x = Area, y = Rate, fill = Area)) +
geom_col(color = "black", alpha = 0.7) +
scale_fill_manual(name = NULL, values = agData_Colors) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total Number of Farm Operators",
y = "Percent of Population", x = NULL, caption = myCaption)
ggsave("farmers_canada_1_05.png", mp, width = 6, height = 4)
Farm Operators by Gender
Canada
# Prep data
xx <- dd %>%
filter(Area == "Canada", Measurement %in% c("Male","Female")) %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, fill = Measurement)) +
geom_col(position = "dodge", color = "black", alpha = 0.7) +
scale_fill_manual(name = NULL, values = myColors_Sex) +
theme_agData(legend.position = "bottom") +
labs(title = "Canada", subtitle = "Total Number of Farm Operators",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_2_01.png", mp, width = 6, height = 4)
Saskatchewan
# Prep data
xx <- dd %>%
filter(Area == "Saskatchewan", Measurement %in% c("Male","Female")) %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, fill = Measurement)) +
geom_col(position = "dodge", color = "black", alpha = 0.7) +
scale_fill_manual(name = NULL, values = myColors_Sex) +
theme_agData(legend.position = "bottom") +
labs(title = "Saskatchewan", subtitle = "Total Number of Farm Operators",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_2_02.png", mp, width = 6, height = 4)
Provinces
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement %in% c("Male","Female")) %>%
mutate(Year = factor(Year))
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, fill = Measurement)) +
geom_col(position = "dodge", color = "black", alpha = 0.7) +
facet_wrap(Area ~ ., scales = "free_y", ncol = 5) +
scale_fill_manual(name = NULL, values = myColors_Sex) +
theme_agData(legend.position = "bottom",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Total Number of Farm Operators",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_2_03.png", mp, width = 10, height = 5)
Percent
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement %in% c("Male","Female")) %>%
group_by(Year, Area) %>%
mutate(Percent = 100 * Value / sum(Value)) %>%
filter(Measurement == "Male")
# Plot
mp <- ggplot(xx, aes(x = Year, y = Percent)) +
geom_line(color = "steelblue", alpha = 0.7, size = 1.25) +
geom_point(alpha = 0.5) +
facet_wrap(Area ~ ., ncol = 5) +
scale_y_continuous(breaks = seq(60, 85, by = 5),
minor_breaks = seq(60, 85, by = 5)) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
theme_agData(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Farm Operators", x = NULL,
y = "Percent Males", caption = myCaption)
ggsave("farmers_canada_2_04.png", mp, width = 10, height = 5)
2021 Pies
# Prep data
xx <- dd %>%
filter(Area != "Canada", Year == 2021,
Measurement %in% c("Male","Female")) %>%
mutate(Year = factor(Year)) %>%
group_by(Year, Area) %>%
mutate(Percent = 100 * Value / sum(Value))
# Plot
mp <- ggplot(xx, aes(x = "", y = Percent, fill = Measurement)) +
geom_col(color = "black", alpha = 0.7) +
coord_polar("y", start = 0) +
facet_wrap(Area ~ ., ncol = 5) +
scale_fill_manual(name = NULL, values = myColors_Sex) +
theme_agData_pie(legend.position = "bottom") +
labs(title = "Percent of Farm Operators (2021)",
caption = myCaption)
ggsave("farmers_canada_2_05.png", mp, width = 10, height = 5)
Farm Operators by Age
Average Age
Canada
# Prep data
xx <- dd %>%
filter(Area == "Canada", Measurement == "Average age of farm operators")
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value)) +
geom_line(color = "darkred", alpha = 0.7, size = 1.5) +
geom_point(alpha = 0.5) +
scale_y_continuous(breaks = 44:58, minor_breaks = 44:58) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
theme_agData() +
labs(title = "Average Age of Farm Operators in Canada",
y = "Age", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_01.png", mp, width = 6, height = 4)
Saskatchewan
# Prep data
xx <- dd %>%
filter(Area == "Saskatchewan", Measurement == "Average age of farm operators")
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value)) +
geom_line(color = "darkred", alpha = 0.7, size = 1.5) +
geom_point(alpha = 0.5) +
scale_y_continuous(breaks = 44:58, minor_breaks = 44:58) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
theme_agData() +
labs(title = "Average Age of Farm Operators in Saskatchewan",
y = "Age", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_02.png", mp, width = 6, height = 4)
Provinces
# Prep data
xx <- dd %>%
filter(Area != "Canada", Measurement == "Average age of farm operators")
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value)) +
geom_line(color = "darkred", alpha = 0.7, size = 0.75) +
geom_point(alpha = 0.5) +
facet_wrap(Area ~ ., ncol = 5) +
scale_y_continuous(breaks = seq(44, 58, by = 2)) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
theme_agData(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Average age of farm operators",
y = "Age", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_03.png", mp, width = 10, height = 5)
Age Group
Canada
# Prep data
myMeasures <- c("Under 35 years","35 to 54 years","55 years and over")
xx <- dd %>%
filter(Area == "Canada",
Measurement %in% myMeasures)
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, color = Measurement)) +
geom_line(size = 1.5, alpha = 0.7) +
geom_point() +
theme_agData(legend.position = "bottom") +
scale_color_manual(name = NULL, values = myColors_Age) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
labs(title = "Total Number of Farm Operators in Canada",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_04.png", mp, width = 6, height = 4)
Saskatchewan
# Prep data
xx <- dd %>%
filter(Area == "Saskatchewan",
Measurement %in% myMeasures)
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, color = Measurement)) +
geom_line(size = 1.5, alpha = 0.7) +
geom_point() +
theme_agData(legend.position = "bottom") +
scale_color_manual(name = NULL, values = myColors_Age) +
scale_x_continuous(breaks = unique(xx$Year),
minor_breaks = unique(xx$Year)) +
labs(title = "Total Number of Farm Operators in Saskatchewan",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_05.png", mp, width = 6, height = 4)
Provinces
# Prep data
xx <- dd %>%
filter(Area != "Canada",
Measurement %in% myMeasures)
# Plot
mp <- ggplot(xx, aes(x = Year, y = Value / 1000, color = Measurement)) +
geom_line(size = 1.5, alpha = 0.7) +
geom_point() +
facet_wrap(Area ~ ., ncol = 5, scale = "free_y") +
theme_agData(legend.position = "bottom") +
scale_color_manual(name = NULL, values = myColors_Age) +
labs(title = "Total Number of Farm Operators in Canada",
y = "Thousand", x = NULL, caption = myCaption)
ggsave("farmers_canada_3_06.png", mp, width = 10, height = 5)
2021 Pies
# Prep data
xx <- dd %>%
filter(Area != "Canada", Year == 2021,
Measurement %in% myMeasures) %>%
mutate(Year = factor(Year)) %>%
group_by(Year, Area) %>%
mutate(Percent = 100 * Value / sum(Value))
# Plot
mp <- ggplot(xx, aes(x = "", y = Percent, fill = Measurement)) +
geom_col(color = "black", alpha = 0.7) +
coord_polar("y", start = 0) +
facet_wrap(Area ~ ., ncol = 5) +
scale_fill_manual(name = NULL, values = myColors_Age) +
theme_agData_pie(legend.position = "bottom") +
labs(title = "Percent of Farm Operators (2021)", caption = myCaption)
ggsave("farmers_canada_3_07.png", mp, width = 10, height = 5)