@@ -18,6 +18,7 @@ options(width = 100)
18
18
19
19
library(tidyverse )
20
20
library(patchwork )
21
+ library(psych )
21
22
22
23
# #__________________________________________________________________________________________________
23
24
# ### 1. Loading data ####
@@ -28,6 +29,9 @@ glimpse(mam_dski)
28
29
load(" ../rawdata/mam_alhd.RData" )
29
30
glimpse(mam_alhd )
30
31
32
+ load(" ../rawdata/mam_comadre.RData" )
33
+ glimpse(mam_comadre )
34
+
31
35
# #__________________________________________________________________________________________________
32
36
# ### 2. Summary of the DSKI data ####
33
37
@@ -230,3 +234,40 @@ ggsave(bm_lon + bm_lit,
230
234
231
235
save(lifehistory , file = " data/lifehistory.RData" )
232
236
237
+ # #__________________________________________________________________________________________________
238
+ # ### 7. Combining with comadre data ####
239
+
240
+ # comadre at the species level
241
+ mam_comadre_spp <- mam_comadre %> %
242
+ group_by(gbif.species.id ) %> %
243
+ summarise(gbif.species = gbif.species [1 ],
244
+ generation_time = mean(generation_time , na.rm = T ),
245
+ life_expectancy = mean(life_expectancy , na.rm = T ),
246
+ adult_survival = mean(adult_survival , na.rm = T )) %> %
247
+ ungroup()
248
+
249
+ # combine
250
+ lifehistory_all <- lifehistory %> %
251
+ left_join(x = . , y = select(mam_comadre_spp , - 2 ), by = " gbif.species.id" )
252
+
253
+ # pairs plots
254
+ lifehistory_complete <- lifehistory_all %> %
255
+ na.omit() %> %
256
+ mutate_at(.vars = 10 : 12 , .funs = function (x ){log(x + 1 )}) %> %
257
+ rename_all(.funs = str_to_sentence ) %> %
258
+ rename(`Generation time` = Generation_time ,
259
+ `Life expectancy` = Life_expectancy ,
260
+ `Adult survival` = Adult_survival )
261
+
262
+ jpeg(" plots/lifehistory_raw/life_history_covariance.jpeg" ,
263
+ width = 15 , height = 15 , units = " cm" ,res = 600 )
264
+ pairs.panels(lifehistory_complete [,7 : 12 ],
265
+ ellipses = FALSE , lm = TRUE , method = " spearman" )
266
+ dev.off()
267
+
268
+
269
+
270
+
271
+
272
+
273
+
0 commit comments