load(here::here('data/lizard_trait_data.Rda'))
library(ggpubr)
## Loading required package: ggplot2
library(ggplot2)

ggboxplot(trait, x = 'reproductive_mode', y = 'latitude',
          color = 'reproductive_mode', palette = 'jco',
          add = 'jitter') + 
  stat_compare_means(method = 't.test')

ggboxplot(trait, x = 'foraging_mode', y = 'latitude',
          color = 'foraging_mode', palette = 'jco',
          add = 'jitter') + 
  stat_compare_means(method = 'anova')

ggboxplot(trait, x = 'activity_time', y = 'latitude',
          color = 'activity_time', palette = 'jco',
          add = 'jitter') + 
  stat_compare_means(method = 'anova')

# latitude and size
ggscatter(data = trait, x = "latitude", y = "maxSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "latitude", y = "fSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "latitude", y = "hatchlingSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

# temp seasonality and size
ggscatter(data = trait, x = "temp_seasonality", y = "maxSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "temp_seasonality", y = "fSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "temp_seasonality", y = "hatchlingSVL", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

# latitude/seasonality and clutch size
ggscatter(data = trait, x = "temp_seasonality", y = "clutch_size", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "latitude", y = "clutch_size", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

# do larger lizards have bigger clutches?

ggscatter(data = trait, x = "fSVL", y = "clutch_size", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'

ggscatter(data = trait, x = "hatchlingSVL", y = "clutch_size", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson")
## `geom_smooth()` using formula 'y ~ x'