install.packages(c("corrplot", "ggplot2", "forcats", "reshape2", "gridExtra", "BioStatR", "FactoMineR", "factoextra", "mclust", "cluster", "ppclust", "circlize", "ggalluvial")) install.packages(c("lme4", "quantreg")) install.packages("FactoMineR") install.packages("FactoMineR") install.packages("FactoMineR") install.packages("nloptr") install.packages("nloptr") install.packages("FactoMineR") install.packages(c("corrplot", "ggplot2", "forcats", "reshape2", "gridExtra", "BioStatR", "FactoMineR", "factoextra", "mclust", "cluster", "ppclust", "circlize", "ggalluvial")) clear knitr::opts_chunk$set(echo = TRUE) library(ggplot2) library(gridExtra) library(reshape2) library(corrplot) ggplot(melt(T[1:18]),aes(x=variable,y=value))+ geom_boxplot()+ theme(axis.text.x = element_text(angle=90, vjust = 0.5, hjust = 1)) knitr::opts_chunk$set(echo = TRUE) library(ggplot2) library(gridExtra) library(reshape2) library(corrplot) T = read.table("DataProjet3MIC-2425.txt",header=TRUE,sep=";") T$ExpT1 = as.factor(T$ExpT1) T$ExpT2 = as.factor(T$ExpT2) T$ExpT3 = as.factor(T$ExpT3) head(T) summary(T) str(T) levels(T$ExpT1) g1<-ggplot(T, aes(x=T$ExpT1))+ geom_bar()+ ylab("Effectifs")+ggtitle("Effectifs") g2<-ggplot(T, aes(x = T$ExpT1)) + geom_bar(aes(y = (..count..)/sum(..count..)))+ylab("")+ggtitle("Frequences") df <- data.frame(group = levels(T$ExpT1), value = as.vector(table(T$ExpT1))/nrow(T)) g3<-ggplot(df, aes(x="", y=value, fill=group))+ geom_bar(width = 1, stat = "identity")+ coord_polar("y", start=0)+ theme(legend.position="bottom") grid.arrange(g3,g1,g2,ncol=3) g1<-ggplot(T, aes(x=T$ExpT2))+ geom_bar()+ ylab("Effectifs")+ggtitle("Effectifs") g2<-ggplot(T, aes(x = T$ExpT2)) + geom_bar(aes(y = (..count..)/sum(..count..)))+ylab("")+ggtitle("Frequences") df <- data.frame(group = levels(T$ExpT2), value = as.vector(table(T$ExpT2))/nrow(T)) g3<-ggplot(df, aes(x="", y=value, fill=group))+ geom_bar(width = 1, stat = "identity")+ coord_polar("y", start=0)+ theme(legend.position="bottom") grid.arrange(g3,g1,g2,ncol=3) g1<-ggplot(T, aes(x=T$ExpT3))+ geom_bar()+ ylab("Effectifs")+ggtitle("Effectifs") g2<-ggplot(T, aes(x = T$ExpT3)) + geom_bar(aes(y = (..count..)/sum(..count..)))+ylab("")+ggtitle("Frequences") df <- data.frame(group = levels(T$ExpT3), value = as.vector(table(T$ExpT3))/nrow(T)) g3<-ggplot(df, aes(x="", y=value, fill=group))+ geom_bar(width = 1, stat = "identity")+ coord_polar("y", start=0)+ theme(legend.position="bottom") grid.arrange(g3,g1,g2,ncol=3) #apply(T[-c(37:39)],2,function(col){ # which(T == col) #hist(col, main = paste("Histogram of", colnames(T)[which(T == col)[2]]), # xlab = "Values", col = "lightblue", border = "black") #}) T_long = melt(T[-c(37:39)]) ggplot(T_long, aes(x = value)) + geom_histogram(binwidth = 1, fill = "blue", color = "black", alpha = 0.7) + facet_wrap(~variable,scales = "free",ncol=6) + labs(title = "Histograms for Each Column", x = "Values", y = "Frequency") ggplot(melt(T[1:18]),aes(x=variable,y=value))+ geom_boxplot()+ theme(axis.text.x = element_text(angle=90, vjust = 0.5, hjust = 1)) ggplot(melt(T[19:36]),aes(x=variable,y=value))+ geom_boxplot() + theme(axis.text.x = element_text(angle=90, vjust = 0.5, hjust = 1)) cr = cor(T[-c(37:39)]) corrplot(cr,method="ellipse", type="lower", bg = "lightgrey") cr = cor(T[-c(37:39)]) corrplot(cr,method="ellipse", type="lower", bg = "lightgrey") library(knitr) ## Global options options(max.print="75") opts_chunk$set(echo=TRUE, cache=FALSE, prompt=FALSE, tidy=TRUE, comment=NA, message=FALSE, warning=FALSE, class.source="badCode") opts_knit$set(width=75) library(corrplot) library(ggplot2) library(gridExtra) library(forcats) library(reshape2) library(BioStatR) wine <- read.table("wine.txt",header=TRUE) head(wine) # A COMPLETER dim(wine) nrow(wine) ncol(wine) # A COMPLETER is.data.frame(wine) attributes(wine) # A COMPLETER str(wine) wine$Qualite<-as.factor(wine$Qualite) wine$Type<-factor(wine$Type,labels=c("blanc","rouge")) head(wine) summary(wine) gEx <- ggplot(data=wine) summary(gEx) names(gEx) gEx$layers ggplot(data=wine,aes(x=Densite,y=Alcool))+ geom_point() ggplot(data=wine)+ geom_point(aes(x=Densite,y=Alcool,color=Type)) ggplot(data=wine)+ geom_point(aes(x=Densite,y=Alcool),color="blue") ggplot(data=wine)+ geom_violin(aes(x=Qualite,y=Alcool))+ geom_point(aes(x=Qualite,y=Alcool), col = "blue", alpha = 0.2,position="jitter") ggplot(data=wine)+ geom_point(aes(x=Alcool,y=Densite,size=AcidVol,color=Type))+ scale_size("Acide vol.", range = c(0,1.5),breaks=seq(0,1.5,0.2)) + scale_x_continuous("Alcool",limits=c(8,16)) + scale_y_continuous("Densité",limits=c(0.985,1.01)) # A COMPLETER t <- table(wine$Type) summary(wine$Type) levels(wine$Type) # A COMPLETER mean(wine$Alcool) median(wine$Alcool) var(wine$Alcool) sd(wine$Alcool) e <- range(wine$Alcool) e e[2]-e[1] # A COMPLETER²² summary(wine$Alcool) q1 = quantile(wine$Alcool,0.25) q2 = quantile(wine$Alcool,0.75) IQR(wine$Alcool) q2-q1 Lp = q2+1.5*(q2-q1) Lm = q1-1.5*(q2-q1) print("valeurs adjacentes :") Lp Lm # A COMPLETER H <- hist(wine$Alcool) H ggplot(wine,aes(y=Alcool))+geom_boxplot() # A COMPLETER B<-boxplot(wine$Alcool) quantile(wine$Alcool) B # A COMPLETER cr = cor(wine[c("Alcool","AcidVol","AcidCitr","SO2lbr","SO2tot","Densite")]) corrplot(cr,method="number", type="lower", bg = "lightgrey",) # A COMPLETER ggplot(wine,aes(x=wine$Alcool,y=wine$Densite))+geom_point()+geom_smooth(method="lm") # A COMPLETER ggplot(wine,aes(x=wine$Type,y=wine$Alcool))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$Alcool))+ geom_boxplot() # A COMPLETER ggplot(wine,aes(x=wine$Type,y=wine$Densite))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$Densite))+ geom_boxplot() ggplot(wine,aes(x=wine$Type,y=wine$AcidVol))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$AcidVol))+ geom_boxplot() ggplot(wine,aes(x=wine$Type,y=wine$SO2lbr))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$SO2lbr))+ geom_boxplot() ggplot(wine,aes(x=wine$Type,y=wine$AcidCitr))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$AcidCitr))+ geom_boxplot() ggplot(wine,aes(x=wine$Type,y=wine$SO2tot))+ geom_boxplot() ggplot(wine,aes(x=wine$Qualite,y=wine$SO2tot))+ geom_boxplot() # A COMPLETER eta2(wine$AcidVol,wine$Type) eta2(wine$AcidCitr,wine$Type) eta2(wine$SO2lbr,wine$Type) eta2(wine$SO2tot,wine$Type) eta2(wine$Densite,wine$Type) eta2(wine$Alcool,wine$Type) # A COMPLETER t= table(wine$Type,wine$Qualite) addmargins(t) # A COMPLETER mosaicplot(prop.table(t)) g1<-ggplot(wine, aes(x=Type))+ geom_bar()+ ylab("Effectifs")+ggtitle("Effectifs") g2<-ggplot(wine, aes(x = Type)) + geom_bar(aes(y = (..count..)/sum(..count..)))+ylab("")+ggtitle("Frequences") df <- data.frame(group = levels(wine$Type), value = as.vector(table(wine$Type))/nrow(wine)) g3<-ggplot(df, aes(x="", y=value, fill=group))+ geom_bar(width = 1, stat = "identity")+ coord_polar("y", start=0)+ theme(legend.position="bottom") grid.arrange(g3,g1,g2,ncol=3) # A COMPLETER t <- table(wine$Type) summary(wine$Type) levels(wine$Type) ggplot(wine,aes(x=wine$Type,y=wine$Alcool))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(wine,aes(x=T$T1_6H_R1,y=T$ExpT1))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(wine,aes(y=T$T1_6H_R1,x=T$ExpT1))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(wine,aes(y=T$T1_6H_R1,x=levels(T$ExpT1)))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(y=T$T1_6H_R1,x=T$ExpT1))+ geom_boxplot() ggplot(wine,aes(x=T$T1_6H_R2,y=T$ExpT1))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(y=T$T1_6H_R1,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T1_6H_R2,y=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T1_6H_R1,y=T$ExpT2))+ geom_boxplot() ggplot(T,aes(x=T$T1_6H_R2,y=T$ExpT2))+ geom_boxplot() ggplot(T,aes(x=T$T1_6H_R1,y=T$ExpT3))+ geom_boxplot() ggplot(T,aes(x=T$T1_6H_R2,y=T$ExpT3))+ geom_boxplot() # traitement 2 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(x=T$T2_6H_R1,y=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T2_6H_R2,y=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T2_6H_R1,y=T$ExpT2))+ geom_boxplot() ggplot(T,aes(x=T$T2_6H_R2,y=T$ExpT2))+ geom_boxplot() ggplot(T,aes(x=T$T2_6H_R1,y=T$ExpT3))+ geom_boxplot() ggplot(T,aes(x=T$T2_6H_R2,y=T$ExpT3))+ geom_boxplot() # traitement 2 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(x=T$T3_6H_R1,y=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T3_6H_R2,y=T$ExpT1))+ geom_boxplot() ggplot(T,aes(x=T$T3_6H_R1,y=T$ExpT3))+ geom_boxplot() ggplot(T,aes(x=T$T3_6H_R2,y=T$ExpT3))+ geom_boxplot() ggplot(T,aes(x=T$T3_6H_R1,y=T$ExpT2))+ geom_boxplot() ggplot(T,aes(x=T$T3_6H_R2,y=T$ExpT2))+ geom_boxplot() T$T2_6H_R2 T$T3_6H_R1 # traitement 1 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(y=T$T1_6H_R1,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T1_6H_R2,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T1_6H_R1,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T1_6H_R2,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T1_6H_R1,x=T$ExpT3))+ geom_boxplot() ggplot(T,aes(y=T$T1_6H_R2,x=T$ExpT3))+ geom_boxplot() # traitement 2 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(y=T$T2_6H_R1,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T2_6H_R2,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T2_6H_R1,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T2_6H_R2,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T2_6H_R1,x=T$ExpT3))+ geom_boxplot() ggplot(T,aes(y=T$T2_6H_R2,x=T$ExpT3))+ geom_boxplot() # traitement 2 corrélation avec l'expression des genes du T1 T2 et T3 ggplot(T,aes(y=T$T3_6H_R1,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T3_6H_R2,x=T$ExpT1))+ geom_boxplot() ggplot(T,aes(y=T$T3_6H_R1,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T3_6H_R2,x=T$ExpT2))+ geom_boxplot() ggplot(T,aes(y=T$T3_6H_R1,x=T$ExpT3))+ geom_boxplot() ggplot(T,aes(y=T$T3_6H_R2,x=T$ExpT3))+ geom_boxplot()