This repository contains the analysis code, written in R, for our paper "Saami reindeer herders cooperate with social group members and genetic kin" (published in Behavioral Ecology). The R code is released under a GNU General Public License. Before running, download the data files and unzip them into a 'data' subfolder.
Main files
Main text.r
-- this reproduces the analyses in the main text's results sectionFigure 3.r
andFigure 4.r
-- reproduces figures 3 and 4 respectivelyTables 1 to 4.r
-- reproduces tables 1-4 in main textSI.r
-- reproduces the analyses in the supplementary information
Auxiliary files
These files are called from within the main files above so you don't need to worry too much about them.
data-funcs/import data.r
-- imports the data files and creates a social network of the giftsdata-funcs/create dyadic data.r
-- creates a dataframe for every ego-alter pair in the sampledata-funcs/create adjacency matrices.r
-- turns the gift network into adjacency matrices for gift giving, siida membership and relatedness. These are used for correlations in the main text and table S3multiplot.r
-- function to plot more than one ggplot in a single output (used for figure 4) (source: Cookbook for R)siida relatedness.r
-- calculates within-siida relatedness as well as grand mean and district mean relatedness (for figure 3 and main text)GEE/GEE models.r
-- generalised estimating equations for tables 3 and S4GEE/standardize-gee.r
-- modifies thestandardize
function in the packagearm
to work with GEE models