McLellan, C. F. & Montgomery, S. H. Evolution of larval gregariousness is associated with host plant specialisation, but not host morphology, in Heliconiini butterflies Callum F. McLellan, University of Bristol, cm15245@bristol.ac.uk Stephen H. Montgomery, University of Bristol, s.montgomery@bristol.ac.uk C. F. McLellan is responsible for collecting data and writing the code. This data folder contains the R scripts to perform all analyses described in the study, all data files needed for analyses and two phylogenetic trees in nexus format needed for analyses. Data files within folder: Variables (columns) in data files are described as follows: 'Genus' = larval genera 'Species' = larval species 'Tag' = larval species as it appears as tip label in phylogeny 'SB' = larval social behaviour in binary format (0/1 = solitary/gregarious) 'Cat_SB' = larval social behaviour in categorical format (0/1/2/3 = NA/SA/MA/LA) 'Cont_SB' = larval social behaviour in continuous format 'WS' = adult wingspan (log transformed), used as proxy for final instar larval size 'Host_num' = number of different Passifloraceae species that larva uses as host 'Host' = Passifloraceae host species 'Habit' = Passifloraceae growth habit 'Habitat' = main habitat type in which Passifloraceae host grows 'Vestiture' = Passifloraceae leaf vestiture (0/1 = glabrous/pubescent) 'Leaf_area' = Passifloraceae leaf area (log10 transformed) 'Phylogeny' = the phylogeny in which the Heliconiini species appears, stated if both Kozak_NEXUS.tre - Heliconiini phylogenetic tree from Kozak et al. (2015). MCMCtree.Priors5.Run1-10.Median.Figtree.nex - Heliconiini phylogenetic tree from Cicconardi et al. (2022). data_cicconardi - Larval trait data used for analyses with Cicconardi et al. phylogeny. data_kozak - Larval trait data used for analyses with Kozak et al. phylogeny. freq_hosts_cicc - Larval trait data used for analyses with Cicconardi et al. phylogeny, where Passifloraceae species used by fewer than four Heliconiini have been omitted. freq_hosts_kozak - Larval trait data used for analyses with Kozak et al. phylogeny, where Passifloraceae species used by fewer than four Heliconiini have been omitted. Host_plants - Recorded Passifloraceae hosts used by Heliconiini species with references. Host_traits - Passifloraceae species and thier recorded traits, including Median leaf width and length. Larvae_traits - All Heliconiini species included across both phylogenies, including recorded larval traits and references for social behaviour. Panama_data - Heliconiini host use data taken from Merrill et al. (2013), including Passifloraceae trait data. 'Lep_num' = number of eggs/larvae recorded by Merrill et al. of each larval species on each host. Removed_Dilkea - The 'data_kozak' dataset adapted to omit three Heliconiini species which are recorded as only feeding on the genus 'Dilkea'. R script files within folder: Cicconardi_phylo_analysis.R - script for calculating phylogenetic signal of traits and analysing interactions with MCMCglmm, using Heliconiini species included in Cicconardi et al. phylogeny. Kozak_phylo_analysis.R - script for calculating phylogenetic signal of traits, analysing interactions with MCMCglmm and analysing supplementary data, using Heliconiini species included in Kozak et al. phylogeny. All quantitative analyses performed using R v. 4.2.2