Init

d<-read.csv("Fig3_Data.csv")
head(d)
##    nr         ant slope       date BodyHeight  ATripod LeverArm1
## 1 185     Formica     0 12.09.2012   2.904936 41.61078  7.396623
## 2 196     Formica     0 13.09.2012   2.405161 34.59066  6.201371
## 3 207     Formica     0 14.09.2012   2.136711 48.59325  8.644638
## 4 225     Formica     0 17.09.2012   2.862029 35.10381  6.589858
## 5 611 Cataglyphis     0 29.10.2012   3.236250 56.30591  8.911453
## 6 621 Cataglyphis     0 29.10.2012   4.100222 43.31875  7.888422
d$slope <- as.character(d$slope)

library(dabestr)
## Warning: package 'dabestr' was built under R version 4.0.4
## Loading required package: magrittr
## Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
## when loading 'dplyr'

Stepping pattern change

Three-point contact area

ATripod <- function(d,antsp){
  df <- subset(d,ant==antsp)
  unpaired_mean_diff <- dabest(df, slope, ATripod,
                               idx = c("0","60"),
                               paired = FALSE)
  
  unpaired_mean_diff
  p<-median_diff(unpaired_mean_diff,reps=5000)
  plot(p,
       rawplot.ylim=c(30,90),effsize.ylim=c(-10,50),float.contrast = F
  )
}
pF <- ATripod(d,"Formica")
pC <-  ATripod(d,"Cataglyphis")
ggpubr::ggarrange(pC,pF)

Front leg effective lever arm

LeverArm <- function(d,antsp){
  df <- subset(d,ant==antsp)
  unpaired_mean_diff <- dabest(df, slope, LeverArm1,
                               idx = c("0","60"),
                               paired = FALSE)
  unpaired_mean_diff
  p<-median_diff(unpaired_mean_diff,reps=5000)
  plot(p,
       rawplot.ylim=c(6,12),effsize.ylim=c(-1,5),float.contrast = F
  )
}
pF <- LeverArm(d,"Formica")
pC <-  LeverArm(d,"Cataglyphis")
ggpubr::ggarrange(pC,pF)

Body Height

BodyHeight <- function(d,antsp){
  df <- subset(d,ant==antsp)
  unpaired_mean_diff <- dabest(df, slope, BodyHeight,
                               idx = c("0","60"),
                               paired = FALSE)
  unpaired_mean_diff
  p<-median_diff(unpaired_mean_diff,reps=5000)
  plot(p,
       rawplot.ylim=c(1.5,6),effsize.ylim=c(-2.5,2),float.contrast = F
  )
}
pF <- BodyHeight(d,"Formica")
pC <- BodyHeight(d,"Cataglyphis")
ggpubr::ggarrange(pC,pF)