I am currently trying to plot the evolution of the distribution of jobs between long term jobs, short term jobs, apprenticeships etc, in a dataset representing the data surrounding the wages of a firm's employees. I thus would like to plot a pie chart per year, yet when I run this code, it doesn't work :
library(ggplot2)
tab <- table(liste_complete$code_contrat)
prop.table(tab)
pie(tab) + facet_wrap(~annee)
I would also welcome any advice on a better plot to represent the evolution of the repartition of type of contract ("code_contrat") across years, hierarchical level (variable "niveau"), type of jobs ("code_statut"),..
Here is the structure of my dataset :
structure(list(numero = c("133", "62", "75", "76", "86", "281"
), tranche_age = c("20-30", "20-30", "20-30", "20-30", "20-30",
"20-30"), tranche_anciennete = c("5 ans et moins", "5 à 10 ans",
"5 ans et moins", "5 ans et moins", "5 à 10 ans", "5 à 10 ans"
), code_statut = c("C", "E", "E", "E", "E", "E"), code_contrat = c("A",
"A", "A", "A", "A", "A"), taux_demploi_mois = c(100, 100, 100,
100, 100, 100), echelon = c("E1 ", " ", " ", " ", " ",
" "), niveau = c("N7 ", " ", " ", " ", " ", " "
), brut_mensuel = c(NA, 786.13, 1156.95, 1156.95, 904.79, 904.79
), estimation_annuelle = c(NA, 10219.69, 15040.35, 15040.35,
11762.27, 11762.27), annee = c(2017, 2017, 2017, 2017, 2017,
2017), primes_en_montant = c(NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_), primes_en_pourcentage = c(NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_)), row.names = c("6",
"7", "8", "9", "10", "11"), class = "data.frame")