1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| ## Semaine 1
S1 = as.data.frame(NULL)
S1[1,1]=NA
S1[1,2]=NA
S1[1,3]=NA
S1[1,4]=NA
S1[1,5]=NA
S1[1,6]=NA
colnames(S1) = c('week','expgroupe','name','patte','mean','sd')
j=1
for (k in 1:nrow(TouteVariableDelexperience)) {
if (TouteVariableDelexperience[k,1] == 'S1') {
ligne = TouteVariableDelexperience[k,]
S1[j,]=ligne
if (ligne[,4]=="PAD"){S1[j,4]="PAD"}
else if (ligne[,4]=="PAG"){S1[j,4]="PAG"}
else if (ligne[,4]=="PPD"){S1[j,4]="PPD"}
else if (ligne[,4]=="PPG"){S1[j,4]="PPG"}
if (ligne[,2]=="SAIN") {S1[j,2]="SAIN"}
else {S1[j,2]="OA"}
j=j+1
}
else if (TouteVariableDelexperience[k,2]=="SAIN"){
ligne = TouteVariableDelexperience[k,]
S1[j,]=ligne
if (ligne[,4]=="PAD"){S1[j,4]="PAD"}
else if (ligne[,4]=="PAG"){S1[j,4]="PAG"}
else if (ligne[,4]=="PPD"){S1[j,4]="PPD"}
else if (ligne[,4]=="PPG"){S1[j,4]="PPG"}
j=j+1}
}
S1$expgroupe = as.factor(S1$expgroupe)
S1$expgroupe = factor(S1$expgroupe,levels(S1$expgroupe)[c(2,1)])
S1$patte = as.factor(S1$patte)
S1$patte = factor(S1$patte,levels(S1$patte)[c(2,1,4,3)])
## Graphs
GRAPH_S1 <- ggplot(S1, aes(x=expgroupe, y=mean, fill=expgroupe)) +
geom_bar(position=position_dodge(), stat="identity")
#+ geom_errorbar(aes(ymin=mean(S1$mean)-sd(PAG$mean), ymax = mean(PAG$mean)+sd(PAG$mean)),width=.2,position=position_dodge(.9)) +
facet_wrap( ~ patte ) +
xlab("Group") +
ylab("Weight repartition (%)") +
ggtitle("Weight repartition during week 1") +
theme_bw()
GRAPH_S1 |
Partager