diff --git "a/module2/exo4/Calcul_t\303\251l\303\251phone.Rmd" "b/module2/exo4/Calcul_t\303\251l\303\251phone.Rmd"
index ea91fb12a93895df36636c4d0f195fdaf26593f2..2854ffa10f1f2026af602a2dd4bf4ac9b514f2f7 100644
--- "a/module2/exo4/Calcul_t\303\251l\303\251phone.Rmd"
+++ "b/module2/exo4/Calcul_t\303\251l\303\251phone.Rmd"
@@ -36,18 +36,21 @@ Tout d'abord on peut plotter les différents paramètres au cours du temps pour
```{r}
barplot(df$Appels_emis, names.arg = df$ï..Date)
```
+
Les dates sont mal positionnées mais c'est pas grave. Il semble que j'ai beaucoup appelé autour de la date du 17 mars.
2. Appels reçus
```{r}
barplot(df$Appels_recus, names.arg = df$ï..Date)
```
+
Il semble que j'ai reçu beaucoup d'appels la veille du 17 mars puis que j'ai reçu + d'appels en général après cette période qu'avant.
3. Durée appel
```{r}
barplot(df$Duree_appel, names.arg = df$ï..Date)
```
+
Là c'est très voyant. J'ai passé beaucoup de temps au téléphone après le 16 mars comparé à avant (sauf 2 fois).
4. Messages reçus
@@ -59,6 +62,7 @@ barplot(df$Messages_recus, names.arg = df$ï..Date)
```{r}
barplot(df$Messages_envoyes, names.arg = df$ï..Date)
```
+
Pour les messages, la tendance est inverse aux appels : je reçois et envoie - de sms depuis le 17 mars comparé à avant.
J'ai eput être changé mon usage de l'un à l'autre.
Sauf autour du 16-17 mars où j'ai beaucoup communiqué.
@@ -165,6 +169,222 @@ library(devtools)
#install_github("EvenStar69/significativity.bar/significativity.bar")
library(significativity.bar)
```
+Bon j'ai dû un peu changer sa fonction parce qu'elle n'est plus compatible avec ggplot 3.3.
+J'ai changé la manière de retrouver les coordonnées y : The position of ymax in ggplot\_build(plot)\$data[[1]] changed from column 6 to 7.
+Et j'ai changé la manière de retrouver l'échalle en y : panel_ranges in ggplot\_build(plot)\$layout does not exist anymore ... use panel\_scale\_y instead.
+J'ai aussi dû mettre à jour R vers la version 3.6.3.
+Voici le code modifié de sa fonction :
+```{r}
+significativity_bar <- function(plot, groups, text = "*", text_height = 0.0275, size_bar = 1, color_bar = "black", size_text = 8, color_text = "black", font_face = 1, font_style = "serif", line_type = "solid"){
+
+
+
+ if (!require("ggplot2", character.only=T, quietly=T)){ # use library ggplot
+
+ install.packages("ggplot2")
+
+ library(ggplot2, character.only=T)
+
+ }
+
+
+
+ if (class(plot)[1] != "gg"){
+
+ stop("Your input plot is not a ggplot")
+
+ }
+
+ if (length(groups) != 2){
+
+ stop("Please select only 2 groups between which you want the error bar")
+
+ }
+
+ if (!is.vector(groups)){
+
+ stop("Please input your 2 selected groups in a vector")
+
+ }
+
+ if (!is.character(text)) {
+
+ stop("Please input the text above the bar as character")
+
+ }
+
+ if (!is.numeric(text_height) | length(text_height) > 1){
+
+ stop("Please input one numeric value for the text height")
+
+ }
+
+ if (!is.numeric(size_bar) | length(size_bar) > 1){
+
+ stop("Please input one numeric value for the bar size")
+
+ }
+
+ if (!is.character(color_bar)){
+
+ stop("Please input an existing R color, as a character, for the color of the bar")
+
+ }
+
+ if (!is.numeric(size_text) | length(size_text) > 1){
+
+ stop("Please input one numeric value for the text size")
+
+ }
+
+ if (!is.numeric(font_face) | length(font_face) > 1){
+
+ stop("Please input one numeric value for the font face")
+
+ }
+
+ if (!is.character(color_text)){
+
+ stop("Please input an existing R color, as a character, for the color of the text")
+
+ }
+
+ if (!is.character(font_style)){
+
+ stop("Please input an existing font family, as a character, for the color of the bar")
+
+ }
+
+ if (!is.character(line_type)){
+
+ stop("Please input an existing line style, as a character, for the color of the bar")
+
+ }
+
+
+
+ if (text_height >=1){
+
+ warning("text_height should be between 0 and 1, default value for * and around 0.04 for text are advised")
+
+ }
+
+
+
+
+
+ if (class(as.list.environment(plot$layers[[1]])$geom)[1] == "GeomPoint"){ # if the ggplot is a dotplot
+
+ coords = ggplot_build(plot)$data[[1]] # get the coordinates of the points
+
+ xcoords = c()
+
+ ycoords = c()
+
+ for (i in groups){ # get the x coordinates of all coordinates in a vector, for the 2 selected groups
+
+ xcoord_temp = unique(coords$x)[i]
+
+ xcoords = append(xcoords, xcoord_temp)
+
+ }
+
+ for (i in c(1,2)){
+
+ ycoord_temp = max(coords[coords$x == xcoords[i],]$y) # get the y coordinate of the upper point of each group
+
+ ycoords = append(ycoords, ycoord_temp)
+
+ }
+
+
+
+ y_range = ggplot_build(plot)$layout$panel_scales_y[[1]]$limits # get the total height of the y scale
+ # panel_ranges in ggplot_build(plot)$layout does not exist anymore ... use panel_scale_y instead
+
+ y_sum = sum(abs(y_range))
+
+ y_scale = (7.5/100)*y_sum # starting position of the vertical bar (determined % of the total y scale)
+
+ bar_height = y_scale + ((5/100)*y_sum) # final position of the vertical bar (determined % of the total y scale in addition to y_scale)
+
+
+
+ ycoord_top = max(ycoords) # the bar should take the heighest of the two groups as a reference
+
+ coord_bar = data.frame(x = c(xcoords[1], xcoords[1], xcoords[2], xcoords[2]), y = c(ycoord_top + y_scale, ycoord_top + bar_height, ycoord_top + bar_height, ycoord_top + y_scale)) # final coordinates of the bar
+
+
+
+ star_x = mean(xcoords) # x coordinate of the text above the bar (in the middle of the two groups)
+
+ star_y = ycoord_top + bar_height + ((2.75/100)*y_sum) # y coordinate of the text above the bar (above the bar by a determined factor)
+
+ coord_star = c(star_x, star_y) # x,y coordinates of the text above the bar
+
+
+
+ plot = plot + geom_path(data = coord_bar, aes(x=x, y=y), size = size_bar, color = color_bar, linetype = line_type) + annotate("text", x = star_x, y = star_y, label = text, size = size_text, color = color_text, fontface = font_face, family = font_style) # create the new ggplot
+
+ print(plot)
+
+
+
+ } else if (class(as.list.environment(plot$layers[[1]])$geom)[1] == "GeomBar") { # if the ggplot is a dotplot
+
+ coords = ggplot_build(plot)$data[[1]]
+
+ xcoords = c()
+
+ ycoords = c()
+
+ for (i in groups){ # get the x and y coordinates of the two groups
+
+ xcoord_temp = mean(c(coords[i,]$xmin, coords[i,]$xmax))
+
+ xcoords = append(xcoords, xcoord_temp)
+
+ ycoord_temp = coords[i,7] # The position of ymax in ggplot_build(plot)$data[[1]] changed from column 6 to 7
+
+ ycoords = append(ycoords, ycoord_temp)
+
+ }
+
+
+
+ y_range = ggplot_build(plot)$layout$panel_scales_y[[1]]$limits # get the total height of the y scale
+
+ y_sum = sum(abs(y_range))
+
+ y_scale = (7.5/100)*y_sum # starting position of the vertical bar (determined % of the total y scale)
+
+ bar_height = y_scale + ((5/100)*y_sum) # final position of the vertical bar (determined % of the total y scale in addition to y_scale)
+
+
+
+ ycoord_top = max(ycoords) # the bar should take the heighest of the two groups as a reference
+
+ coord_bar = data.frame(x = c(xcoords[1], xcoords[1], xcoords[2], xcoords[2]), y = c(ycoord_top + y_scale, ycoord_top + bar_height, ycoord_top + bar_height, ycoord_top + y_scale)) # final coordinates of the bar
+
+
+
+ star_x = mean(xcoords) # x coordinate of the text above the bar (in the middle of the two groups)
+
+ star_y = ycoord_top + bar_height + (text_height*y_sum) # y coordinate of the text above the bar (above the bar by a determined factor)
+
+ coord_star = c(star_x, star_y) # x,y coordinates of the text above the bar
+
+
+
+ plot = plot + geom_path(data = coord_bar, aes(x=x, y=y), size = size_bar, color = color_bar, linetype = line_type) + annotate("text", x = star_x, y = star_y, label = text, size = size_text, color = color_text, fontface = font_face, family = font_style) # create the new ggplot
+
+ print(plot)
+
+ }
+
+}
+```
+
```{r}
gg<- ggplot(c, aes(x = c..aa....ap.., y = as.numeric(m_duree_appel)))+
@@ -172,6 +392,7 @@ gg<- ggplot(c, aes(x = c..aa....ap.., y = as.numeric(m_duree_appel)))+
geom_errorbar(ymin = m_duree_appel-sd_duree_appel, ymax = m_duree_appel+sd_duree_appel)+
ylim(-500,5000)+
labs(title="Duree appel")
+significativity_bar(gg, groups = c(1,2))
```
@@ -193,4 +414,7 @@ En moyenne c'est assez équilibré : je réponds autant de fois qu'on m'envoie u
## Conclusion
__J'ai passé pas mal de temps à faire ça mais ça m'a permis de bien prendre en main l'outil.
-Je conçois que mon étude est assez sale et que les manières de plotter ne sont vraiment pas optimisées mais ce n'était pas vraiment le but de l'exercice.__
+Je conçois que mon étude est assez sale et que les manières de plotter ne sont vraiment pas optimisées mais ce n'était pas vraiment le but de l'exercice.__
+
+__Après avoir compilé, je n'ai pas pû le faire en pdf (des erreurs de polices qui ne passent pas avec LaTeX on dirait ...).
+Aussi, j'ai remarqué qu'il fallait laissé un retour chariot après la visualisation du plot sinon le texte se met à côté dans le rendu.__
diff --git "a/module2/exo4/Calcul_t\303\251l\303\251phone.html" "b/module2/exo4/Calcul_t\303\251l\303\251phone.html"
index f2b177937b56eb29733ebbfba6f9efb1c777e2e9..ee5190693ee6442a0e9ac9a31c9105f1bbe57d6d 100644
--- "a/module2/exo4/Calcul_t\303\251l\303\251phone.html"
+++ "b/module2/exo4/Calcul_t\303\251l\303\251phone.html"
@@ -420,17 +420,20 @@ head(df)
Les appels émis
barplot(df$Appels_emis, names.arg = df$ï..Date)
-
Les dates sont mal positionnées mais c’est pas grave. Il semble que j’ai beaucoup appelé autour de la date du 17 mars.
+
+Les dates sont mal positionnées mais c’est pas grave. Il semble que j’ai beaucoup appelé autour de la date du 17 mars.
- Appels reçus
barplot(df$Appels_recus, names.arg = df$ï..Date)
-
Il semble que j’ai reçu beaucoup d’appels la veille du 17 mars puis que j’ai reçu + d’appels en général après cette période qu’avant.
+
+Il semble que j’ai reçu beaucoup d’appels la veille du 17 mars puis que j’ai reçu + d’appels en général après cette période qu’avant.
- Durée appel
barplot(df$Duree_appel, names.arg = df$ï..Date)
-
Là c’est très voyant. J’ai passé beaucoup de temps au téléphone après le 16 mars comparé à avant (sauf 2 fois).
+
+Là c’est très voyant. J’ai passé beaucoup de temps au téléphone après le 16 mars comparé à avant (sauf 2 fois).
- Messages reçus
@@ -440,7 +443,8 @@ head(df)
Messages envoyés
barplot(df$Messages_envoyes, names.arg = df$ï..Date)
-
Pour les messages, la tendance est inverse aux appels : je reçois et envoie - de sms depuis le 17 mars comparé à avant.
+

+Pour les messages, la tendance est inverse aux appels : je reçois et envoie - de sms depuis le 17 mars comparé à avant.
J’ai eput être changé mon usage de l’un à l’autre.
Sauf autour du 16-17 mars où j’ai beaucoup communiqué.
@@ -568,11 +572,226 @@ library(devtools)
#Besoin de Rtools 3.5
#install_github("EvenStar69/significativity.bar/significativity.bar")
library(significativity.bar)
+
Bon j’ai dû un peu changer sa fonction parce qu’elle n’est plus compatible avec ggplot 3.3.
+J’ai changé la manière de retrouver les coordonnées y : The position of ymax in ggplot_build(plot)$data[[1]] changed from column 6 to 7.
+Et j’ai changé la manière de retrouver l’échalle en y : panel_ranges in ggplot_build(plot)$layout does not exist anymore … use panel_scale_y instead.
+J’ai aussi dû mettre à jour R vers la version 3.6.3.
+Voici le code modifié de sa fonction :
+
significativity_bar <- function(plot, groups, text = "*", text_height = 0.0275, size_bar = 1, color_bar = "black", size_text = 8, color_text = "black", font_face = 1, font_style = "serif", line_type = "solid"){
+
+
+
+ if (!require("ggplot2", character.only=T, quietly=T)){ # use library ggplot
+
+ install.packages("ggplot2")
+
+ library(ggplot2, character.only=T)
+
+ }
+
+
+
+ if (class(plot)[1] != "gg"){
+
+ stop("Your input plot is not a ggplot")
+
+ }
+
+ if (length(groups) != 2){
+
+ stop("Please select only 2 groups between which you want the error bar")
+
+ }
+
+ if (!is.vector(groups)){
+
+ stop("Please input your 2 selected groups in a vector")
+
+ }
+
+ if (!is.character(text)) {
+
+ stop("Please input the text above the bar as character")
+
+ }
+
+ if (!is.numeric(text_height) | length(text_height) > 1){
+
+ stop("Please input one numeric value for the text height")
+
+ }
+
+ if (!is.numeric(size_bar) | length(size_bar) > 1){
+
+ stop("Please input one numeric value for the bar size")
+
+ }
+
+ if (!is.character(color_bar)){
+
+ stop("Please input an existing R color, as a character, for the color of the bar")
+
+ }
+
+ if (!is.numeric(size_text) | length(size_text) > 1){
+
+ stop("Please input one numeric value for the text size")
+
+ }
+
+ if (!is.numeric(font_face) | length(font_face) > 1){
+
+ stop("Please input one numeric value for the font face")
+
+ }
+
+ if (!is.character(color_text)){
+
+ stop("Please input an existing R color, as a character, for the color of the text")
+
+ }
+
+ if (!is.character(font_style)){
+
+ stop("Please input an existing font family, as a character, for the color of the bar")
+
+ }
+
+ if (!is.character(line_type)){
+
+ stop("Please input an existing line style, as a character, for the color of the bar")
+
+ }
+
+
+
+ if (text_height >=1){
+
+ warning("text_height should be between 0 and 1, default value for * and around 0.04 for text are advised")
+
+ }
+
+
+
+
+
+ if (class(as.list.environment(plot$layers[[1]])$geom)[1] == "GeomPoint"){ # if the ggplot is a dotplot
+
+ coords = ggplot_build(plot)$data[[1]] # get the coordinates of the points
+
+ xcoords = c()
+
+ ycoords = c()
+
+ for (i in groups){ # get the x coordinates of all coordinates in a vector, for the 2 selected groups
+
+ xcoord_temp = unique(coords$x)[i]
+
+ xcoords = append(xcoords, xcoord_temp)
+
+ }
+
+ for (i in c(1,2)){
+
+ ycoord_temp = max(coords[coords$x == xcoords[i],]$y) # get the y coordinate of the upper point of each group
+
+ ycoords = append(ycoords, ycoord_temp)
+
+ }
+
+
+
+ y_range = ggplot_build(plot)$layout$panel_scales_y[[1]]$limits # get the total height of the y scale
+ # panel_ranges in ggplot_build(plot)$layout does not exist anymore ... use panel_scale_y instead
+
+ y_sum = sum(abs(y_range))
+
+ y_scale = (7.5/100)*y_sum # starting position of the vertical bar (determined % of the total y scale)
+
+ bar_height = y_scale + ((5/100)*y_sum) # final position of the vertical bar (determined % of the total y scale in addition to y_scale)
+
+
+
+ ycoord_top = max(ycoords) # the bar should take the heighest of the two groups as a reference
+
+ coord_bar = data.frame(x = c(xcoords[1], xcoords[1], xcoords[2], xcoords[2]), y = c(ycoord_top + y_scale, ycoord_top + bar_height, ycoord_top + bar_height, ycoord_top + y_scale)) # final coordinates of the bar
+
+
+
+ star_x = mean(xcoords) # x coordinate of the text above the bar (in the middle of the two groups)
+
+ star_y = ycoord_top + bar_height + ((2.75/100)*y_sum) # y coordinate of the text above the bar (above the bar by a determined factor)
+
+ coord_star = c(star_x, star_y) # x,y coordinates of the text above the bar
+
+
+
+ plot = plot + geom_path(data = coord_bar, aes(x=x, y=y), size = size_bar, color = color_bar, linetype = line_type) + annotate("text", x = star_x, y = star_y, label = text, size = size_text, color = color_text, fontface = font_face, family = font_style) # create the new ggplot
+
+ print(plot)
+
+
+
+ } else if (class(as.list.environment(plot$layers[[1]])$geom)[1] == "GeomBar") { # if the ggplot is a dotplot
+
+ coords = ggplot_build(plot)$data[[1]]
+
+ xcoords = c()
+
+ ycoords = c()
+
+ for (i in groups){ # get the x and y coordinates of the two groups
+
+ xcoord_temp = mean(c(coords[i,]$xmin, coords[i,]$xmax))
+
+ xcoords = append(xcoords, xcoord_temp)
+
+ ycoord_temp = coords[i,7] # The position of ymax in ggplot_build(plot)$data[[1]] changed from column 6 to 7
+
+ ycoords = append(ycoords, ycoord_temp)
+
+ }
+
+
+
+ y_range = ggplot_build(plot)$layout$panel_scales_y[[1]]$limits # get the total height of the y scale
+
+ y_sum = sum(abs(y_range))
+
+ y_scale = (7.5/100)*y_sum # starting position of the vertical bar (determined % of the total y scale)
+
+ bar_height = y_scale + ((5/100)*y_sum) # final position of the vertical bar (determined % of the total y scale in addition to y_scale)
+
+
+
+ ycoord_top = max(ycoords) # the bar should take the heighest of the two groups as a reference
+
+ coord_bar = data.frame(x = c(xcoords[1], xcoords[1], xcoords[2], xcoords[2]), y = c(ycoord_top + y_scale, ycoord_top + bar_height, ycoord_top + bar_height, ycoord_top + y_scale)) # final coordinates of the bar
+
+
+
+ star_x = mean(xcoords) # x coordinate of the text above the bar (in the middle of the two groups)
+
+ star_y = ycoord_top + bar_height + (text_height*y_sum) # y coordinate of the text above the bar (above the bar by a determined factor)
+
+ coord_star = c(star_x, star_y) # x,y coordinates of the text above the bar
+
+
+
+ plot = plot + geom_path(data = coord_bar, aes(x=x, y=y), size = size_bar, color = color_bar, linetype = line_type) + annotate("text", x = star_x, y = star_y, label = text, size = size_text, color = color_text, fontface = font_face, family = font_style) # create the new ggplot
+
+ print(plot)
+
+ }
+
+}
gg<- ggplot(c, aes(x = c..aa....ap.., y = as.numeric(m_duree_appel)))+
geom_bar(stat = "identity")+
geom_errorbar(ymin = m_duree_appel-sd_duree_appel, ymax = m_duree_appel+sd_duree_appel)+
ylim(-500,5000)+
- labs(title="Duree appel")
+ labs(title="Duree appel")
+significativity_bar(gg, groups = c(1,2))
+

Taux de réponses
@@ -592,6 +811,8 @@ barplot(Ratio)
Conclusion
J’ai passé pas mal de temps à faire ça mais ça m’a permis de bien prendre en main l’outil.
Je conçois que mon étude est assez sale et que les manières de plotter ne sont vraiment pas optimisées mais ce n’était pas vraiment le but de l’exercice.
+
Après avoir compilé, je n’ai pas pû le faire en pdf (des erreurs de polices qui ne passent pas avec LaTeX on dirait …).
+Aussi, j’ai remarqué qu’il fallait laissé un retour chariot après la visualisation du plot sinon le texte se met à côté dans le rendu.
diff --git "a/module2/exo4/Calcul_t\303\251l\303\251phone.log" "b/module2/exo4/Calcul_t\303\251l\303\251phone.log"
index db5cd542963001219cd82807b45618dd80ea6a4e..220430a05f5147ab00175449a4147d30777cc7b2 100644
--- "a/module2/exo4/Calcul_t\303\251l\303\251phone.log"
+++ "b/module2/exo4/Calcul_t\303\251l\303\251phone.log"
@@ -1,4 +1,4 @@
-This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6500 64-bit) (preloaded format=pdflatex 2018.1.29) 7 APR 2020 21:22
+This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6500 64-bit) (preloaded format=pdflatex 2018.1.29) 8 APR 2020 12:31
entering extended mode
**./Calcul_téléphone.tex
(Calcul_téléphone.tex
diff --git "a/module2/exo4/Calcul_t\303\251l\303\251phone.tex" "b/module2/exo4/Calcul_t\303\251l\303\251phone.tex"
index 7d5ae851ee9a807302e1171a41a225a34d4fadd9..1d8856e4fe80176e3ae8b014f9d64f7a8f0e885c 100644
--- "a/module2/exo4/Calcul_t\303\251l\303\251phone.tex"
+++ "b/module2/exo4/Calcul_t\303\251l\303\251phone.tex"
@@ -173,6 +173,7 @@ pour se donner un aperçu de mon usage :
\end{Shaded}
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-2-1.pdf}
+
Les dates sont mal positionnées mais c'est pas grave. Il semble que j'ai
beaucoup appelé autour de la date du 17 mars.
@@ -191,6 +192,7 @@ beaucoup appelé autour de la date du 17 mars.
\end{Shaded}
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-3-1.pdf}
+
Il semble que j'ai reçu beaucoup d'appels la veille du 17 mars puis que
j'ai reçu + d'appels en général après cette période qu'avant.
@@ -209,6 +211,7 @@ j'ai reçu + d'appels en général après cette période qu'avant.
\end{Shaded}
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-4-1.pdf}
+
Là c'est très voyant. J'ai passé beaucoup de temps au téléphone après le
16 mars comparé à avant (sauf 2 fois).
@@ -243,6 +246,7 @@ Là c'est très voyant. J'ai passé beaucoup de temps au téléphone après le
\end{Shaded}
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-6-1.pdf}
+
Pour les messages, la tendance est inverse aux appels : je reçois et
envoie - de sms depuis le 17 mars comparé à avant.\\
J'ai eput être changé mon usage de l'un à l'autre.\\
@@ -325,44 +329,9 @@ Et les écarts-types :
\NormalTok{sd\_duree\_appel\textless{}{-}}\KeywordTok{c}\NormalTok{(}\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Duree\_appel[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"avant"}\NormalTok{]), }\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Duree\_appel[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"après"}\NormalTok{]))}
\NormalTok{sd\_messages\_recus\textless{}{-}}\KeywordTok{c}\NormalTok{(}\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Messages\_recus[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"avant"}\NormalTok{]), }\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Messages\_recus[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"après"}\NormalTok{]))}
\NormalTok{sd\_messages\_envoyes\textless{}{-}}\KeywordTok{c}\NormalTok{(}\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Messages\_envoyes[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"avant"}\NormalTok{]), }\KeywordTok{sd}\NormalTok{(df}\OperatorTok{$}\NormalTok{Messages\_envoyes[df}\OperatorTok{$}\NormalTok{add}\OperatorTok{==}\StringTok{"après"}\NormalTok{]))}
-\NormalTok{sd\_appels\_emis}
-\end{Highlighting}
-\end{Shaded}
-
-\begin{verbatim}
-## [1] 2.128044 2.379476
-\end{verbatim}
-
-\begin{Shaded}
-\begin{Highlighting}[]
-\NormalTok{sd\_appels\_recus}
-\end{Highlighting}
-\end{Shaded}
-
-\begin{verbatim}
-## [1] 1.939563 1.435933
-\end{verbatim}
-
-\begin{Shaded}
-\begin{Highlighting}[]
-\NormalTok{sd\_messages\_recus}
-\end{Highlighting}
-\end{Shaded}
-
-\begin{verbatim}
-## [1] 5.080776 4.097618
-\end{verbatim}
-
-\begin{Shaded}
-\begin{Highlighting}[]
-\NormalTok{sd\_messages\_envoyes}
\end{Highlighting}
\end{Shaded}
-\begin{verbatim}
-## [1] 5.330505 2.502380
-\end{verbatim}
-
Maintenant on va pouvoir plotter les moyennes de tous les paramètres
avant et après (inclus) le 17 mars 2020.\\
Le mieux c'est d'utiliser ggplot.
@@ -380,6 +349,12 @@ Le mieux c'est d'utiliser ggplot.
\end{Highlighting}
\end{Shaded}
+\begin{verbatim}
+## Warning: Use of `a$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+
+## Warning: Use of `a$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-10-1.pdf}
\begin{Shaded}
@@ -393,6 +368,22 @@ Le mieux c'est d'utiliser ggplot.
\end{Highlighting}
\end{Shaded}
+\begin{verbatim}
+## Warning: Use of `b$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `b$m_appels_recus` is discouraged. Use `m_appels_recus` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `b$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `b$m_appels_recus` is discouraged. Use `m_appels_recus` instead.
+\end{verbatim}
+
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-11-1.pdf}
\begin{Shaded}
@@ -406,6 +397,22 @@ Le mieux c'est d'utiliser ggplot.
\end{Highlighting}
\end{Shaded}
+\begin{verbatim}
+## Warning: Use of `c$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `c$m_duree_appel` is discouraged. Use `m_duree_appel` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `c$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `c$m_duree_appel` is discouraged. Use `m_duree_appel` instead.
+\end{verbatim}
+
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-12-1.pdf}
\begin{Shaded}
@@ -419,6 +426,24 @@ Le mieux c'est d'utiliser ggplot.
\end{Highlighting}
\end{Shaded}
+\begin{verbatim}
+## Warning: Use of `d$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `d$m_messages_envoyes` is discouraged. Use `m_messages_envoyes`
+## instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `d$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `d$m_messages_envoyes` is discouraged. Use `m_messages_envoyes`
+## instead.
+\end{verbatim}
+
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-13-1.pdf}
\begin{Shaded}
@@ -432,6 +457,24 @@ Le mieux c'est d'utiliser ggplot.
\end{Highlighting}
\end{Shaded}
+\begin{verbatim}
+## Warning: Use of `e$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `e$m_messages_recus` is discouraged. Use `m_messages_recus`
+## instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `e$c..aa....ap..` is discouraged. Use `c..aa....ap..` instead.
+\end{verbatim}
+
+\begin{verbatim}
+## Warning: Use of `e$m_messages_recus` is discouraged. Use `m_messages_recus`
+## instead.
+\end{verbatim}
+
\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-14-1.pdf}
\textbf{Bilan : On voit des augmentations dans les appels et une
@@ -502,6 +545,267 @@ le 17 mars 2020. Je ne suis pas super fort en statistiques donc j'espère
que c'est correct. Aussi, 21 échantillons par groupe c'est pas mal pour
un test non paramétrique.
+Du coup on va essayer de mettre une étoile sur le plot (ce qui n'est pas
+compris dans les fonctions ggplot).\\
+Pour cela on va donc tester le code d'un ami disponible sur
+\href{https://github.com/EvenStar69/significativity.bar}{Github}.
+
+\begin{Shaded}
+\begin{Highlighting}[]
+\CommentTok{\#install.packages("devtools")}
+\KeywordTok{library}\NormalTok{(devtools)}
+\end{Highlighting}
+\end{Shaded}
+
+\begin{verbatim}
+## Loading required package: usethis
+\end{verbatim}
+
+\begin{Shaded}
+\begin{Highlighting}[]
+\CommentTok{\#Besoin de Rtools 3.5}
+\CommentTok{\#install\_github("EvenStar69/significativity.bar/significativity.bar")}
+\KeywordTok{library}\NormalTok{(significativity.bar)}
+\end{Highlighting}
+\end{Shaded}
+
+Bon j'ai dû un peu changer sa fonction parce qu'elle n'est plus
+compatible avec ggplot 3.3.\\
+J'ai changé la manière de retrouver les coordonnées y : The position of
+ymax in ggplot\_build(plot)\$data{[}{[}1{]}{]} changed from column 6 to
+7.\\
+Et j'ai changé la manière de retrouver l'échalle en y : panel\_ranges in
+ggplot\_build(plot)\$layout does not exist anymore \ldots{} use
+panel\_scale\_y instead.\\
+J'ai aussi dû mettre à jour R vers la version 3.6.3.\\
+Voici le code modifié de sa fonction :
+
+\begin{Shaded}
+\begin{Highlighting}[]
+\NormalTok{significativity\_bar \textless{}{-}}\StringTok{ }\ControlFlowTok{function}\NormalTok{(plot, groups, }\DataTypeTok{text =} \StringTok{"*"}\NormalTok{, }\DataTypeTok{text\_height =} \FloatTok{0.0275}\NormalTok{, }\DataTypeTok{size\_bar =} \DecValTok{1}\NormalTok{, }\DataTypeTok{color\_bar =} \StringTok{"black"}\NormalTok{, }\DataTypeTok{size\_text =} \DecValTok{8}\NormalTok{, }\DataTypeTok{color\_text =} \StringTok{"black"}\NormalTok{, }\DataTypeTok{font\_face =} \DecValTok{1}\NormalTok{, }\DataTypeTok{font\_style =} \StringTok{"serif"}\NormalTok{, }\DataTypeTok{line\_type =} \StringTok{"solid"}\NormalTok{)\{}
+
+
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{require}\NormalTok{(}\StringTok{"ggplot2"}\NormalTok{, }\DataTypeTok{character.only=}\NormalTok{T, }\DataTypeTok{quietly=}\NormalTok{T))\{ }\CommentTok{\# use library ggplot}
+
+ \KeywordTok{install.packages}\NormalTok{(}\StringTok{"ggplot2"}\NormalTok{)}
+
+ \KeywordTok{library}\NormalTok{(ggplot2, }\DataTypeTok{character.only=}\NormalTok{T)}
+
+\NormalTok{ \}}
+
+
+
+ \ControlFlowTok{if}\NormalTok{ (}\KeywordTok{class}\NormalTok{(plot)[}\DecValTok{1}\NormalTok{] }\OperatorTok{!=}\StringTok{ "gg"}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Your input plot is not a ggplot"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\KeywordTok{length}\NormalTok{(groups) }\OperatorTok{!=}\StringTok{ }\DecValTok{2}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please select only 2 groups between which you want the error bar"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.vector}\NormalTok{(groups))\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input your 2 selected groups in a vector"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.character}\NormalTok{(text)) \{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input the text above the bar as character"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.numeric}\NormalTok{(text\_height) }\OperatorTok{|}\StringTok{ }\KeywordTok{length}\NormalTok{(text\_height) }\OperatorTok{\textgreater{}}\StringTok{ }\DecValTok{1}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input one numeric value for the text height"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.numeric}\NormalTok{(size\_bar) }\OperatorTok{|}\StringTok{ }\KeywordTok{length}\NormalTok{(size\_bar) }\OperatorTok{\textgreater{}}\StringTok{ }\DecValTok{1}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input one numeric value for the bar size"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.character}\NormalTok{(color\_bar))\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input an existing R color, as a character, for the color of the bar"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.numeric}\NormalTok{(size\_text) }\OperatorTok{|}\StringTok{ }\KeywordTok{length}\NormalTok{(size\_text) }\OperatorTok{\textgreater{}}\StringTok{ }\DecValTok{1}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input one numeric value for the text size"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.numeric}\NormalTok{(font\_face) }\OperatorTok{|}\StringTok{ }\KeywordTok{length}\NormalTok{(font\_face) }\OperatorTok{\textgreater{}}\StringTok{ }\DecValTok{1}\NormalTok{)\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input one numeric value for the font face"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.character}\NormalTok{(color\_text))\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input an existing R color, as a character, for the color of the text"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.character}\NormalTok{(font\_style))\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input an existing font family, as a character, for the color of the bar"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{if}\NormalTok{ (}\OperatorTok{!}\KeywordTok{is.character}\NormalTok{(line\_type))\{}
+
+ \KeywordTok{stop}\NormalTok{(}\StringTok{"Please input an existing line style, as a character, for the color of the bar"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+
+
+ \ControlFlowTok{if}\NormalTok{ (text\_height }\OperatorTok{\textgreater{}=}\DecValTok{1}\NormalTok{)\{}
+
+ \KeywordTok{warning}\NormalTok{(}\StringTok{"text\_height should be between 0 and 1, default value for * and around 0.04 for text are advised"}\NormalTok{)}
+
+\NormalTok{ \}}
+
+
+
+
+
+ \ControlFlowTok{if}\NormalTok{ (}\KeywordTok{class}\NormalTok{(}\KeywordTok{as.list.environment}\NormalTok{(plot}\OperatorTok{$}\NormalTok{layers[[}\DecValTok{1}\NormalTok{]])}\OperatorTok{$}\NormalTok{geom)[}\DecValTok{1}\NormalTok{] }\OperatorTok{==}\StringTok{ "GeomPoint"}\NormalTok{)\{ }\CommentTok{\# if the ggplot is a dotplot}
+
+\NormalTok{ coords =}\StringTok{ }\KeywordTok{ggplot\_build}\NormalTok{(plot)}\OperatorTok{$}\NormalTok{data[[}\DecValTok{1}\NormalTok{]] }\CommentTok{\# get the coordinates of the points}
+
+\NormalTok{ xcoords =}\StringTok{ }\KeywordTok{c}\NormalTok{()}
+
+\NormalTok{ ycoords =}\StringTok{ }\KeywordTok{c}\NormalTok{()}
+
+ \ControlFlowTok{for}\NormalTok{ (i }\ControlFlowTok{in}\NormalTok{ groups)\{ }\CommentTok{\# get the x coordinates of all coordinates in a vector, for the 2 selected groups}
+
+\NormalTok{ xcoord\_temp =}\StringTok{ }\KeywordTok{unique}\NormalTok{(coords}\OperatorTok{$}\NormalTok{x)[i]}
+
+\NormalTok{ xcoords =}\StringTok{ }\KeywordTok{append}\NormalTok{(xcoords, xcoord\_temp)}
+
+\NormalTok{ \}}
+
+ \ControlFlowTok{for}\NormalTok{ (i }\ControlFlowTok{in} \KeywordTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{,}\DecValTok{2}\NormalTok{))\{}
+
+\NormalTok{ ycoord\_temp =}\StringTok{ }\KeywordTok{max}\NormalTok{(coords[coords}\OperatorTok{$}\NormalTok{x }\OperatorTok{==}\StringTok{ }\NormalTok{xcoords[i],]}\OperatorTok{$}\NormalTok{y) }\CommentTok{\# get the y coordinate of the upper point of each group}
+
+\NormalTok{ ycoords =}\StringTok{ }\KeywordTok{append}\NormalTok{(ycoords, ycoord\_temp)}
+
+\NormalTok{ \}}
+
+
+
+\NormalTok{ y\_range =}\StringTok{ }\KeywordTok{ggplot\_build}\NormalTok{(plot)}\OperatorTok{$}\NormalTok{layout}\OperatorTok{$}\NormalTok{panel\_scales\_y[[}\DecValTok{1}\NormalTok{]]}\OperatorTok{$}\NormalTok{limits }\CommentTok{\# get the total height of the y scale}
+ \CommentTok{\# panel\_ranges in ggplot\_build(plot)$layout does not exist anymore ... use panel\_scale\_y instead}
+
+\NormalTok{ y\_sum =}\StringTok{ }\KeywordTok{sum}\NormalTok{(}\KeywordTok{abs}\NormalTok{(y\_range)) }
+
+\NormalTok{ y\_scale =}\StringTok{ }\NormalTok{(}\FloatTok{7.5}\OperatorTok{/}\DecValTok{100}\NormalTok{)}\OperatorTok{*}\NormalTok{y\_sum }\CommentTok{\# starting position of the vertical bar (determined \% of the total y scale)}
+
+\NormalTok{ bar\_height =}\StringTok{ }\NormalTok{y\_scale }\OperatorTok{+}\StringTok{ }\NormalTok{((}\DecValTok{5}\OperatorTok{/}\DecValTok{100}\NormalTok{)}\OperatorTok{*}\NormalTok{y\_sum) }\CommentTok{\# final position of the vertical bar (determined \% of the total y scale in addition to y\_scale)}
+
+
+
+\NormalTok{ ycoord\_top =}\StringTok{ }\KeywordTok{max}\NormalTok{(ycoords) }\CommentTok{\# the bar should take the heighest of the two groups as a reference}
+
+\NormalTok{ coord\_bar =}\StringTok{ }\KeywordTok{data.frame}\NormalTok{(}\DataTypeTok{x =} \KeywordTok{c}\NormalTok{(xcoords[}\DecValTok{1}\NormalTok{], xcoords[}\DecValTok{1}\NormalTok{], xcoords[}\DecValTok{2}\NormalTok{], xcoords[}\DecValTok{2}\NormalTok{]), }\DataTypeTok{y =} \KeywordTok{c}\NormalTok{(ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{y\_scale, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{y\_scale)) }\CommentTok{\# final coordinates of the bar}
+
+
+
+\NormalTok{ star\_x =}\StringTok{ }\KeywordTok{mean}\NormalTok{(xcoords) }\CommentTok{\# x coordinate of the text above the bar (in the middle of the two groups)}
+
+\NormalTok{ star\_y =}\StringTok{ }\NormalTok{ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height }\OperatorTok{+}\StringTok{ }\NormalTok{((}\FloatTok{2.75}\OperatorTok{/}\DecValTok{100}\NormalTok{)}\OperatorTok{*}\NormalTok{y\_sum) }\CommentTok{\# y coordinate of the text above the bar (above the bar by a determined factor)}
+
+\NormalTok{ coord\_star =}\StringTok{ }\KeywordTok{c}\NormalTok{(star\_x, star\_y) }\CommentTok{\# x,y coordinates of the text above the bar}
+
+
+
+\NormalTok{ plot =}\StringTok{ }\NormalTok{plot }\OperatorTok{+}\StringTok{ }\KeywordTok{geom\_path}\NormalTok{(}\DataTypeTok{data =}\NormalTok{ coord\_bar, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x=}\NormalTok{x, }\DataTypeTok{y=}\NormalTok{y), }\DataTypeTok{size =}\NormalTok{ size\_bar, }\DataTypeTok{color =}\NormalTok{ color\_bar, }\DataTypeTok{linetype =}\NormalTok{ line\_type) }\OperatorTok{+}\StringTok{ }\KeywordTok{annotate}\NormalTok{(}\StringTok{"text"}\NormalTok{, }\DataTypeTok{x =}\NormalTok{ star\_x, }\DataTypeTok{y =}\NormalTok{ star\_y, }\DataTypeTok{label =}\NormalTok{ text, }\DataTypeTok{size =}\NormalTok{ size\_text, }\DataTypeTok{color =}\NormalTok{ color\_text, }\DataTypeTok{fontface =}\NormalTok{ font\_face, }\DataTypeTok{family =}\NormalTok{ font\_style) }\CommentTok{\# create the new ggplot}
+
+ \KeywordTok{print}\NormalTok{(plot)}
+
+
+
+\NormalTok{ \} }\ControlFlowTok{else} \ControlFlowTok{if}\NormalTok{ (}\KeywordTok{class}\NormalTok{(}\KeywordTok{as.list.environment}\NormalTok{(plot}\OperatorTok{$}\NormalTok{layers[[}\DecValTok{1}\NormalTok{]])}\OperatorTok{$}\NormalTok{geom)[}\DecValTok{1}\NormalTok{] }\OperatorTok{==}\StringTok{ "GeomBar"}\NormalTok{) \{ }\CommentTok{\# if the ggplot is a dotplot}
+
+\NormalTok{ coords =}\StringTok{ }\KeywordTok{ggplot\_build}\NormalTok{(plot)}\OperatorTok{$}\NormalTok{data[[}\DecValTok{1}\NormalTok{]]}
+
+\NormalTok{ xcoords =}\StringTok{ }\KeywordTok{c}\NormalTok{() }
+
+\NormalTok{ ycoords =}\StringTok{ }\KeywordTok{c}\NormalTok{()}
+
+ \ControlFlowTok{for}\NormalTok{ (i }\ControlFlowTok{in}\NormalTok{ groups)\{ }\CommentTok{\# get the x and y coordinates of the two groups }
+
+\NormalTok{ xcoord\_temp =}\StringTok{ }\KeywordTok{mean}\NormalTok{(}\KeywordTok{c}\NormalTok{(coords[i,]}\OperatorTok{$}\NormalTok{xmin, coords[i,]}\OperatorTok{$}\NormalTok{xmax))}
+
+\NormalTok{ xcoords =}\StringTok{ }\KeywordTok{append}\NormalTok{(xcoords, xcoord\_temp)}
+
+\NormalTok{ ycoord\_temp =}\StringTok{ }\NormalTok{coords[i,}\DecValTok{7}\NormalTok{] }\CommentTok{\# The position of ymax in ggplot\_build(plot)$data[[1]] changed from column 6 to 7}
+
+\NormalTok{ ycoords =}\StringTok{ }\KeywordTok{append}\NormalTok{(ycoords, ycoord\_temp)}
+
+\NormalTok{ \}}
+
+
+
+\NormalTok{ y\_range =}\StringTok{ }\KeywordTok{ggplot\_build}\NormalTok{(plot)}\OperatorTok{$}\NormalTok{layout}\OperatorTok{$}\NormalTok{panel\_scales\_y[[}\DecValTok{1}\NormalTok{]]}\OperatorTok{$}\NormalTok{limits }\CommentTok{\# get the total height of the y scale}
+
+\NormalTok{ y\_sum =}\StringTok{ }\KeywordTok{sum}\NormalTok{(}\KeywordTok{abs}\NormalTok{(y\_range))}
+
+\NormalTok{ y\_scale =}\StringTok{ }\NormalTok{(}\FloatTok{7.5}\OperatorTok{/}\DecValTok{100}\NormalTok{)}\OperatorTok{*}\NormalTok{y\_sum }\CommentTok{\# starting position of the vertical bar (determined \% of the total y scale)}
+
+\NormalTok{ bar\_height =}\StringTok{ }\NormalTok{y\_scale }\OperatorTok{+}\StringTok{ }\NormalTok{((}\DecValTok{5}\OperatorTok{/}\DecValTok{100}\NormalTok{)}\OperatorTok{*}\NormalTok{y\_sum) }\CommentTok{\# final position of the vertical bar (determined \% of the total y scale in addition to y\_scale)}
+
+
+
+\NormalTok{ ycoord\_top =}\StringTok{ }\KeywordTok{max}\NormalTok{(ycoords) }\CommentTok{\# the bar should take the heighest of the two groups as a reference}
+
+\NormalTok{ coord\_bar =}\StringTok{ }\KeywordTok{data.frame}\NormalTok{(}\DataTypeTok{x =} \KeywordTok{c}\NormalTok{(xcoords[}\DecValTok{1}\NormalTok{], xcoords[}\DecValTok{1}\NormalTok{], xcoords[}\DecValTok{2}\NormalTok{], xcoords[}\DecValTok{2}\NormalTok{]), }\DataTypeTok{y =} \KeywordTok{c}\NormalTok{(ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{y\_scale, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height, ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{y\_scale)) }\CommentTok{\# final coordinates of the bar}
+
+
+
+\NormalTok{ star\_x =}\StringTok{ }\KeywordTok{mean}\NormalTok{(xcoords) }\CommentTok{\# x coordinate of the text above the bar (in the middle of the two groups)}
+
+\NormalTok{ star\_y =}\StringTok{ }\NormalTok{ycoord\_top }\OperatorTok{+}\StringTok{ }\NormalTok{bar\_height }\OperatorTok{+}\StringTok{ }\NormalTok{(text\_height}\OperatorTok{*}\NormalTok{y\_sum) }\CommentTok{\# y coordinate of the text above the bar (above the bar by a determined factor)}
+
+\NormalTok{ coord\_star =}\StringTok{ }\KeywordTok{c}\NormalTok{(star\_x, star\_y) }\CommentTok{\# x,y coordinates of the text above the bar}
+
+
+
+\NormalTok{ plot =}\StringTok{ }\NormalTok{plot }\OperatorTok{+}\StringTok{ }\KeywordTok{geom\_path}\NormalTok{(}\DataTypeTok{data =}\NormalTok{ coord\_bar, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x=}\NormalTok{x, }\DataTypeTok{y=}\NormalTok{y), }\DataTypeTok{size =}\NormalTok{ size\_bar, }\DataTypeTok{color =}\NormalTok{ color\_bar, }\DataTypeTok{linetype =}\NormalTok{ line\_type) }\OperatorTok{+}\StringTok{ }\KeywordTok{annotate}\NormalTok{(}\StringTok{"text"}\NormalTok{, }\DataTypeTok{x =}\NormalTok{ star\_x, }\DataTypeTok{y =}\NormalTok{ star\_y, }\DataTypeTok{label =}\NormalTok{ text, }\DataTypeTok{size =}\NormalTok{ size\_text, }\DataTypeTok{color =}\NormalTok{ color\_text, }\DataTypeTok{fontface =}\NormalTok{ font\_face, }\DataTypeTok{family =}\NormalTok{ font\_style) }\CommentTok{\# create the new ggplot}
+
+ \KeywordTok{print}\NormalTok{(plot)}
+
+\NormalTok{ \}}
+
+\NormalTok{\}}
+\end{Highlighting}
+\end{Shaded}
+
+\begin{Shaded}
+\begin{Highlighting}[]
+\NormalTok{gg\textless{}{-}}\StringTok{ }\KeywordTok{ggplot}\NormalTok{(c, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ c..aa....ap.., }\DataTypeTok{y =} \KeywordTok{as.numeric}\NormalTok{(m\_duree\_appel)))}\OperatorTok{+}
+\StringTok{ }\KeywordTok{geom\_bar}\NormalTok{(}\DataTypeTok{stat =} \StringTok{"identity"}\NormalTok{)}\OperatorTok{+}
+\StringTok{ }\KeywordTok{geom\_errorbar}\NormalTok{(}\DataTypeTok{ymin =}\NormalTok{ m\_duree\_appel}\OperatorTok{{-}}\NormalTok{sd\_duree\_appel, }\DataTypeTok{ymax =}\NormalTok{ m\_duree\_appel}\OperatorTok{+}\NormalTok{sd\_duree\_appel)}\OperatorTok{+}\StringTok{ }
+\StringTok{ }\KeywordTok{ylim}\NormalTok{(}\OperatorTok{{-}}\DecValTok{500}\NormalTok{,}\DecValTok{5000}\NormalTok{)}\OperatorTok{+}
+\StringTok{ }\KeywordTok{labs}\NormalTok{(}\DataTypeTok{title=}\StringTok{"Duree appel"}\NormalTok{)}
+\KeywordTok{significativity\_bar}\NormalTok{(gg, }\DataTypeTok{groups =} \KeywordTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{,}\DecValTok{2}\NormalTok{))}
+\end{Highlighting}
+\end{Shaded}
+
+\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-19-1.pdf}
+
\hypertarget{taux-de-ruxe9ponses}{%
\subsubsection{Taux de réponses}\label{taux-de-ruxe9ponses}}
@@ -518,7 +822,7 @@ qu'on m'en envoie.
\end{Highlighting}
\end{Shaded}
-\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-17-1.pdf}
+\includegraphics{Calcul_téléphone_files/figure-latex/unnamed-chunk-20-1.pdf}
\begin{Shaded}
\begin{Highlighting}[]
@@ -542,4 +846,9 @@ Je conçois que mon étude est assez sale et que les manières de plotter
ne sont vraiment pas optimisées mais ce n'était pas vraiment le but de
l'exercice.}
+\textbf{Après avoir compilé, je n'ai pas pû le faire en pdf (des erreurs
+de polices qui ne passent pas avec LaTeX on dirait \ldots).\\
+Aussi, j'ai remarqué qu'il fallait laissé un retour chariot après la
+visualisation du plot sinon le texte se met à côté dans le rendu.}
+
\end{document}
diff --git a/module2/exo4/test notebook.Rmd b/module2/exo4/test notebook.Rmd
new file mode 100644
index 0000000000000000000000000000000000000000..aee8e4b0358d17b252ee3a967f8513388af34677
--- /dev/null
+++ b/module2/exo4/test notebook.Rmd
@@ -0,0 +1,18 @@
+---
+title: "R Notebook"
+output: html_notebook
+---
+
+This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
+
+Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*.
+
+```{r}
+plot(cars)
+```
+
+Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*.
+
+When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file).
+
+The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.
diff --git a/module2/exo4/test notebook.nb.html b/module2/exo4/test notebook.nb.html
new file mode 100644
index 0000000000000000000000000000000000000000..ff0850a09f1c174f250b601395d644ae221a50d1
--- /dev/null
+++ b/module2/exo4/test notebook.nb.html
@@ -0,0 +1,1843 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+R Notebook
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
+
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
+
+
+
+
plot(cars)
+
+
+
+
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
+
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
+
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.
+
+
+
LS0tDQp0aXRsZTogIlIgTm90ZWJvb2siDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQpUaGlzIGlzIGFuIFtSIE1hcmtkb3duXShodHRwOi8vcm1hcmtkb3duLnJzdHVkaW8uY29tKSBOb3RlYm9vay4gV2hlbiB5b3UgZXhlY3V0ZSBjb2RlIHdpdGhpbiB0aGUgbm90ZWJvb2ssIHRoZSByZXN1bHRzIGFwcGVhciBiZW5lYXRoIHRoZSBjb2RlLiANCg0KVHJ5IGV4ZWN1dGluZyB0aGlzIGNodW5rIGJ5IGNsaWNraW5nIHRoZSAqUnVuKiBidXR0b24gd2l0aGluIHRoZSBjaHVuayBvciBieSBwbGFjaW5nIHlvdXIgY3Vyc29yIGluc2lkZSBpdCBhbmQgcHJlc3NpbmcgKkN0cmwrU2hpZnQrRW50ZXIqLiANCg0KYGBge3J9DQpwbG90KGNhcnMpDQpgYGANCg0KQWRkIGEgbmV3IGNodW5rIGJ5IGNsaWNraW5nIHRoZSAqSW5zZXJ0IENodW5rKiBidXR0b24gb24gdGhlIHRvb2xiYXIgb3IgYnkgcHJlc3NpbmcgKkN0cmwrQWx0K0kqLg0KDQpXaGVuIHlvdSBzYXZlIHRoZSBub3RlYm9vaywgYW4gSFRNTCBmaWxlIGNvbnRhaW5pbmcgdGhlIGNvZGUgYW5kIG91dHB1dCB3aWxsIGJlIHNhdmVkIGFsb25nc2lkZSBpdCAoY2xpY2sgdGhlICpQcmV2aWV3KiBidXR0b24gb3IgcHJlc3MgKkN0cmwrU2hpZnQrSyogdG8gcHJldmlldyB0aGUgSFRNTCBmaWxlKS4NCg0KVGhlIHByZXZpZXcgc2hvd3MgeW91IGEgcmVuZGVyZWQgSFRNTCBjb3B5IG9mIHRoZSBjb250ZW50cyBvZiB0aGUgZWRpdG9yLiBDb25zZXF1ZW50bHksIHVubGlrZSAqS25pdCosICpQcmV2aWV3KiBkb2VzIG5vdCBydW4gYW55IFIgY29kZSBjaHVua3MuIEluc3RlYWQsIHRoZSBvdXRwdXQgb2YgdGhlIGNodW5rIHdoZW4gaXQgd2FzIGxhc3QgcnVuIGluIHRoZSBlZGl0b3IgaXMgZGlzcGxheWVkLg0K
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/module2/exo4/test.Rmd b/module2/exo4/test.Rmd
new file mode 100644
index 0000000000000000000000000000000000000000..a0854f8943f4f23d55910b5bb1a71b38029b9224
--- /dev/null
+++ b/module2/exo4/test.Rmd
@@ -0,0 +1,17 @@
+---
+title: "test"
+author: "Marc"
+date: "08/04/2020"
+output:
+ pdf_document: default
+ html_document: default
+---
+
+```{r setup, include=FALSE}
+knitr::opts_chunk$set(echo = TRUE)
+```
+
+J'ai changé la manière de retrouver les coordonnées y : The position of ymax in ggplot\_build(plot)\$data[[1]] changed from column 6 to 7.
+Et j'ai changé la manière de retrouver l'échalle en y : panel_ranges in ggplot\_build(plot)\$layout does not exist anymore ... use panel\_scale\_y instead.
+J'ai aussi dû mettre à jour R vers la version 3.6.3.
+Voici le code modifié de sa fonction :
\ No newline at end of file
diff --git a/module2/exo4/test.html b/module2/exo4/test.html
new file mode 100644
index 0000000000000000000000000000000000000000..f9e3e54ba7b17f248b96f9eb21b6ba03defd1a99
--- /dev/null
+++ b/module2/exo4/test.html
@@ -0,0 +1,437 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
J’ai changé la manière de retrouver les coordonnées y : The position of ymax in ggplot_build(plot)$data[[1]] changed from column 6 to 7.
+Et j’ai changé la manière de retrouver l’échalle en y : panel_ranges in ggplot_build(plot)$layout does not exist anymore … use panel_scale_y instead.
+J’ai aussi dû mettre à jour R vers la version 3.6.3.
+Voici le code modifié de sa fonction :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/module2/exo4/test.pdf b/module2/exo4/test.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..6b13d7e3c2d69892b4db4dea9fe98aaf3f864526
Binary files /dev/null and b/module2/exo4/test.pdf differ