library(readxl)
Fat_allo <- read_excel("C:/Users/Admin/Desktop/Fat_allo.xlsx", 
     col_types = c("text", "text", "numeric"))
require(multcomp)
require(lsmeans)
require(ggpubr)
require(car)
attach(Fat_allo)
Treatment=as.factor(Fat_allo$Treatment)
Compartment=as.factor(Fat_allo$Compartment)
plot=ggline(Fat_allo,x="Treatment",y="Allo_fat",color="Compartment",add=c("mean_se","dotplot"),palette = c("black","pink","blue"))
plot
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

model1=lm(Allo_fat~Treatment*Compartment,data = Fat_allo)
anova(model1)
## Analysis of Variance Table
## 
## Response: Allo_fat
##                       Df Sum Sq Mean Sq   F value    Pr(>F)    
## Treatment              3 0.0035 0.00116    0.6881    0.5682    
## Compartment            2 3.8675 1.93373 1149.0027 < 2.2e-16 ***
## Treatment:Compartment  6 0.1360 0.02267   13.4679 1.177e-06 ***
## Residuals             24 0.0404 0.00168                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
posthoc=lsmeans(model1,pairwise~Treatment*Compartment,adjust="Tukey")
cld(posthoc[[1]],alpha=0.05,Letters=letters)
##  Treatment Compartment lsmean     SE df lower.CL upper.CL .group
##  High_carb Fillet      0.0388 0.0237 24  -0.0101   0.0876  a    
##  Control   Fillet      0.0590 0.0237 24   0.0101   0.1078  a    
##  Mixed     Fillet      0.1115 0.0237 24   0.0626   0.1604  ab   
##  High_carb Viscera     0.1434 0.0237 24   0.0945   0.1923  ab   
##  High_fat  Viscera     0.1569 0.0237 24   0.1080   0.2058  ab   
##  High_fat  Fillet      0.1862 0.0237 24   0.1373   0.2351   b   
##  Mixed     Viscera     0.1883 0.0237 24   0.1394   0.2372   b   
##  Control   Viscera     0.1924 0.0237 24   0.1435   0.2413   b   
##  High_fat  Remaining   0.7205 0.0237 24   0.6716   0.7694    c  
##  Mixed     Remaining   0.7788 0.0237 24   0.7299   0.8277    cd 
##  Control   Remaining   0.8493 0.0237 24   0.8005   0.8982     de
##  High_carb Remaining   0.9597 0.0237 24   0.9108   1.0086      e
## 
## Confidence level used: 0.95 
## P value adjustment: tukey method for comparing a family of 12 estimates 
## significance level used: alpha = 0.05