Removing useless tables

This commit is contained in:
Louis Lacoste 2024-05-14 21:27:11 +02:00
parent 6b65a2723e
commit 8ffa0f5614
2 changed files with 3 additions and 37 deletions

View file

@ -6,7 +6,9 @@ execute:
warning: false
fig-width: 10
fig-height: 10
format: html
format:
html:
embed-resources: true
---
## Description des données
@ -134,27 +136,6 @@ htmltools::tagList(lapply(vec_sequences, function(sequence) {
}))
```
### Tableaux
```{r}
#| tbl-cap: !expr 'paste("Table des proportions de choix par cluster pour ",(colnames(data)[3:ncol(data)-1]))'
#| result: asis
ac <- NULL
vec_sequences <- (colnames(data)[3:ncol(data) - 1])
for (sequence in vec_sequences) {
ac <- as.data.frame(table(data[["cluster"]], data[[sequence]], useNA = "ifany"))
colnames(ac) <- c("cluster", "uc", "nb")
ac <- ac %>%
group_by(cluster) %>%
mutate(Prop = nb / sum(nb), uc = str_wrap(uc, 30))
ac_table <- ac %>%
select(-nb) %>%
pivot_wider(names_from = uc, values_from = Prop)
print(ac_table %>% datatable(filter = "top"))
}
```
:::

View file

@ -42,19 +42,4 @@ htmltools::tagList(lapply(vec_sequences, function (sequence) {
p <- ggplotly(ac %>% plot_prop_cluster(eff = effectif_cluster_domi) + ggtitle(paste("Proportion pour", sequence, "- domaine :", nom_dominante)))
p
}))
```
#### Tables
```{r}
#| tbl-cap: !expr 'paste("Table des proportions de choix par cluster pour ",(colnames(data)[3:ncol(data)-1]))'
#| result: asis
ac <- NULL
vec_sequences <- (colnames(data_domi)[4:ncol(data_domi)-1])
for(sequence in vec_sequences) {
ac <- as.data.frame(table(data_domi[["cluster"]], data_domi[[sequence]], useNA = "ifany"))
colnames(ac) <- c("cluster", "uc", "nb")
ac <- ac %>% group_by(cluster) %>% mutate(Prop = nb/sum(nb), uc = str_wrap(uc,30))
ac_table <- ac %>% select(-nb) %>% pivot_wider(names_from = uc, values_from = Prop)
print(ac_table %>% datatable(filter = "top") %>% formatRound(columns = - 1, digits = 3))
}
```