dta <- read.csv("NewP.csv",h=T)
dta <- na.omit(dta)
dta <- dta[-52,]
row.names(dta) <- 1:dim(dta)[1]
summary(Vp <- aov(Valence~Condition,data =dta)) #  p <0.05 *
            Df Sum Sq Mean Sq F value Pr(>F)  
Condition    3   4.76  1.5865   2.733 0.0495 *
Residuals   76  44.12  0.5805                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(Vp)$Condition[c(2,4,6),] # 
                    diff        lwr        upr     p adj
control-bite  0.03333333 -0.5995362 0.66620285 0.9990466
control-clip  0.43333333 -0.1995362 1.06620285 0.2820101
pout-control -0.55833333 -1.1912029 0.07453618 0.1030589
#SNKvp <- SNK.test(Vp,"Condition",df.residual(Vp),deviance(Vp)/df.residual(Vp),group=T)
#Schvp <- scheffe.test(Vp,"Condition",df.residual(Vp),deviance(Vp)/df.residual(Vp),group=T)
#pairwise.t.test(dta$Valence,dta$Condition,,p.adj = "bonf")
summary(Ap <- aov(Arousal~Condition,data =dta))
            Df Sum Sq Mean Sq F value Pr(>F)
Condition    3   5.04   1.679   1.005  0.395
Residuals   76 126.96   1.671               
#TukeyHSD(Ap)$Condition[c(2,4,6),]
summary(Tp <- aov(Typicality~Condition,data =dta))#  p <0.05 *
            Df Sum Sq Mean Sq F value Pr(>F)  
Condition    3   7.88  2.6263     3.4  0.022 *
Residuals   76  58.70  0.7724                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(Tp)$Condition[c(2,4,6),]
                   diff        lwr       upr     p adj
control-bite -0.3416667 -1.0717020 0.3883686 0.6102870
control-clip  0.1916667 -0.5383686 0.9217020 0.9007474
pout-control -0.5250000 -1.2550353 0.2050353 0.2413612
dta2 <- read.csv("newN.csv",h=T)
dta2<- na.omit(dta2)
dta2 <- dta2[-52,]  # For equal subjects
row.names(dta2) <- 1:dim(dta2)[1]
summary(VN <- aov(Valence~Condition,data =dta2))
            Df Sum Sq Mean Sq F value Pr(>F)  
Condition    3  2.642  0.8808   3.321 0.0242 *
Residuals   76 20.155  0.2652                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(VN)$Condition[c(2,4,6),]  # Clip,Pout > Control
               diff          lwr         upr      p adj
control-bite -0.355 -0.782765429  0.07276543 0.13813064
control-clip -0.450 -0.877765429 -0.02223457 0.03537983
pout-control  0.430  0.002234571  0.85776543 0.04832634
summary(AN <- aov(Arousal~Condition,data =dta2))
            Df Sum Sq Mean Sq F value Pr(>F)
Condition    3   1.05  0.3515   0.206  0.892
Residuals   76 129.94  1.7098               
#TukeyHSD(AN)$Condition[c(2,4,6),] 
summary(TN <- aov(Typicality~Condition,data =dta2))
            Df Sum Sq Mean Sq F value Pr(>F)  
Condition    3   9.15   3.051   2.494 0.0663 .
Residuals   76  92.98   1.223                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(TN)$Condition[c(2,4,6),]
                diff        lwr        upr      p adj
control-bite  0.0025 -0.9162719 0.92127194 0.99999987
control-clip  0.3600 -0.5587719 1.27877194 0.73288466
pout-control -0.8250 -1.7437719 0.09377194 0.09405213
VP_se <- summarySE(dta,measurevar = "Valence",groupvars = "Condition" )
VP_se$Dimension <- "Valence"
colnames(VP_se)[3] <- "Rating"
VP_se$Type  <- "Positive"
AP_se <- summarySE(dta,measurevar = "Arousal",groupvars = "Condition" )
AP_se$Dimension <- "Arousal"
AP_se$Type  <- "Positive"
colnames(AP_se)[3] <- "Rating"
Tp_se <- summarySE(dta,measurevar = "Typicality",groupvars = "Condition" )
Tp_se$Dimension <- "Typicality"
Tp_se$Type  <- "Positive"
colnames(Tp_se)[3] <- "Rating"

PSE <- rbind(VP_se,AP_se,Tp_se)

VN_se <- summarySE(dta2,measurevar = "Valence",groupvars = "Condition" )
VN_se$Dimension <- "Valence"
colnames(VN_se)[3] <- "Rating"
VN_se$Type  <- "Negative"
AN_se <- summarySE(dta2,measurevar = "Arousal",groupvars = "Condition" )
AN_se$Dimension <- "Arousal"
AN_se$Type  <- "Negative"
colnames(AN_se)[3] <- "Rating"
TN_se <- summarySE(dta2,measurevar = "Typicality",groupvars = "Condition" )
TN_se$Dimension <- "Typicality"
TN_se$Type  <- "Negative"
colnames(TN_se)[3] <- "Rating"

NSE <- rbind(VN_se,AN_se,TN_se)

dta_se <- rbind(PSE,NSE)
str(dta_se)
'data.frame':   24 obs. of  8 variables:
 $ Condition: Factor w/ 4 levels "bite","clip",..: 1 2 3 4 1 2 3 4 1 2 ...
 $ N        : num  20 20 20 20 20 20 20 20 20 20 ...
 $ Rating   : num  8.03 7.63 8.07 7.51 6.4 ...
 $ sd       : num  0.657 0.876 0.657 0.832 1.366 ...
 $ se       : num  0.147 0.196 0.147 0.186 0.306 ...
 $ ci       : num  0.307 0.41 0.307 0.389 0.639 ...
 $ Dimension: chr  "Valence" "Valence" "Valence" "Valence" ...
 $ Type     : chr  "Positive" "Positive" "Positive" "Positive" ...
dta_se$Condition <- factor(dta_se$Condition,
                           levels = c("control","bite","pout","clip"),
                           labels = c("Control","Bite","Pout","Clip"))
dta_se$Type <- factor(dta_se$Type,
                      levels = c("Positive","Negative"))
dta_se$Dimension <- factor(dta_se$Dimension,
                           levels = c("Valence","Arousal","Typicality"))
ann_text <- data.frame(Condition = c("Pout","Clip"), Rating = c(4,4),lab = "test",
                       Type = factor("Negative",levels = c("Positive","Negative")),
                       Dimension = factor("Valence",levels = c("Valence","Arousal","Typicality")))
ggplot(data  = dta_se,aes(x = Condition,y = Rating, col = Condition,shape = Condition))+
        facet_grid(Type~Dimension)+
        geom_point(size=2)+
        geom_errorbar(aes(x=Condition,ymin = Rating-se,ymax = Rating +se),
                      width=0.1,show.legend = FALSE)+
        theme_bw()+
        scale_colour_manual(values = c("black","grey25","grey45","grey65"))+
        scale_shape_manual(values = c(15,16,17,18))+
        geom_text(data = ann_text,label = "*",size = 7,show.legend = FALSE)+
        labs(list(y= "Rating Scores"))

dta$Type <- "Positive"
dta2$Type <- "Negative"
dtaall <- rbind(dta,dta2)

summary(v1 <- aov(Valence~Type*Condition,data =dtaall))
                Df Sum Sq Mean Sq  F value  Pr(>F)    
Type             1 1011.7  1011.7 2392.703 < 2e-16 ***
Condition        3    1.1     0.4    0.861 0.46293    
Type:Condition   3    6.3     2.1    4.974 0.00255 ** 
Residuals      152   64.3     0.4                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(v1,"Type")
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = Valence ~ Type * Condition, data = dtaall)

$Type
                      diff      lwr      upr p adj
Positive-Negative 5.029167 4.826038 5.232295     0
#with(dtaall,interaction.plot(x.factor = "Condition",trace.factor = "Type",response="Valence",ylim = c(1,9)))
summary(aov(Arousal~Type*Condition,data =dtaall))
                Df Sum Sq Mean Sq F value Pr(>F)  
Type             1   4.89   4.894   2.896 0.0909 .
Condition        3   1.61   0.537   0.318 0.8126  
Type:Condition   3   4.48   1.493   0.884 0.4511  
Residuals      152 256.90   1.690                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(aov(Typicality~Type*Condition,data =dtaall))
                Df Sum Sq Mean Sq F value  Pr(>F)    
Type             1  94.53   94.53   94.73 < 2e-16 ***
Condition        3  16.32    5.44    5.45 0.00138 ** 
Type:Condition   3   0.72    0.24    0.24 0.86857    
Residuals      152 151.68    1.00                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1