thanks to table() : table<-with(commun,table(QUINTILE,resul_colo_final))
I have this table :
resul_final
QUINTILE 1 2 3 4
1 1 0 4 11
2 0 0 8 15
3 0 1 7 11
4 0 1 8 13
5 0 2 7 23
and thanks to the gt package I want to display a data frame. But to do it I have to convert my table in a data frame and if I did it, like this :
table<-as.data.frame(with(commun,table(QUINTILE,resul_final)))
It gave me this result :
| QUINTILE |
resul_final |
Freq |
| 1 |
0 |
1 |
| 2 |
0 |
0 |
| 3 |
0 |
0 |
| 4 |
0 |
0 |
| 5 |
0 |
0 |
| 1 |
1 |
0 |
| 2 |
1 |
0 |
| 3 |
1 |
1 |
| 4 |
1 |
1 |
| 5 |
1 |
2 |
| 1 |
2 |
4 |
| 2 |
2 |
8 |
| 3 |
2 |
7 |
| 4 |
2 |
8 |
| 5 |
2 |
7 |
| 1 |
3 |
11 |
| 2 |
3 |
15 |
| 3 |
3 |
11 |
| 4 |
3 |
13 |
| 5 |
3 |
23 |
my gt code :
table %>%
gt() %>%
tab_header(
title = md("**Frequences de classes**"))
How can I do to have the same dataframe in gt than in table()?