Hello,
I am struggle to export my table into pdf
i have a script with a loop, and I would like to export each table produced by the loop into a pdf file. I don't know which function I can involve in the loop.
I am sharing with you my code , and waiting for your precious help.
Thank you in advance
knitr::opts_chunk$set(echo = FALSE) #le code ne sera pas visible (FALSE)
#valable pour tout le document
library(dplyr)
library(knitr) #Package qu on ajoute pour la mise en forme des résultats
load ("/home/formateur/donnees/depp.Rdata")
for(nat in unique (agents$nature)){
acad_dept <- agents %>%
filter(agents$nature==nat) %>%
group_by(acad, dept = substr(etab, 1, 3)) %>%
summarise( age_moyen = mean (age, na.rm = TRUE),
age_median = median(age, na.rm = TRUE),
age_max = max (age, na.rm = TRUE),
nb_agents = n(), # compter les lignes
nb_etab = n_distinct(etab),
ratio = round(nb_agents / nb_etab, 1),
pct_femmes = sum(sexe == 2, na.rm = TRUE) /
nb_agents * 100) %>%
ungroup()
}