Skip to content

Commit

Permalink
update pg
Browse files Browse the repository at this point in the history
  • Loading branch information
skefi committed Apr 19, 2024
1 parent 4ea15f3 commit affbd28
Show file tree
Hide file tree
Showing 38 changed files with 28,410 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
library(igraph)

#load the data: example for bird-fruit networks
webs<-read.csv("01BirdFruitInteractions.csv")


#create a list of all the study sites sampled
listweb<-unique(webs$plot)
listweb


#Built networks from the data
###function to create an incidence matrix -> apply to (.txt)
my.incidence<-function(gr){
adj<-as.data.frame(as.matrix(as_adjacency_matrix(gr,attr="weight")))
adj<-adj[order(names(adj)),order(names(adj))]
I.index<-max(grep("A_",names(adj)))
adj[1:I.index,(I.index+1):length(names(adj))]
}

#example of code to select the first network of the list, and
#get the network as a igraph object or as a matrix format
web1<-subset(webs,plot==listweb[1])
interweb1<-subset(web1,select=c("plant_species","animal_species","frequency"))
names(interweb1)[3]<-"weight"
interweb1$plant_species<-paste0("P_",interweb1$plant_species)
interweb1$animal_species<-paste0("A_",interweb1$animal_species)
g<-graph_from_data_frame(interweb1,directed=FALSE)
#create incidence matrix
my.incidence(g)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"plot","habitat","habitat_description","lu","elev","map","mat"
"cof1","cof","coffee plantation","disturbed",1303,1300.8,19.06
"cof2","cof","coffee plantation","disturbed",1353,1518.03,19.59
"cof3","cof","coffee plantation","disturbed",1288,1296.51,20.12
"cof4","cof","coffee plantation","disturbed",1134,1115.15,22.6
"cof6","cof","coffee plantation","disturbed",1516,1611,18.56
"fer0","fer","forest erica","undisturbed",3956,1393.13,4.47
"fer5","fer","forest erica","undisturbed",3995,1372.48,4.38
"flm1","flm","forest lower montane","undisturbed",1916,2304.79,15.27
"flm2","flm","forest lower montane","undisturbed",1833,2189.22,15.17
"flm3","flm","forest lower montane","undisturbed",1780,2173.55,16.28
"flm4","flm","forest lower montane","undisturbed",1830,2249.7,16.46
"flm6","flm","forest lower montane","undisturbed",2054,2088.68,14.37
"foc1","foc","forest ocotea","undisturbed",2150,2503.1,12.07
"foc2","foc","forest ocotea","undisturbed",2238,2552.08,12.12
"foc3","foc","forest ocotea","undisturbed",2499,2480.64,11.66
"foc4","foc","forest ocotea","undisturbed",2581,2286.95,11.61
"foc5","foc","forest ocotea","undisturbed",2741,2116.81,9.88
"fod1","fod","forest ocotea disturbed","disturbed",2185,2396.03,13
"fod2","fod","forest ocotea disturbed","disturbed",2495,2202.09,11.02
"fod4","fod","forest ocotea disturbed","disturbed",2568,2289.59,11.07
"fod5","fod","forest ocotea disturbed","disturbed",2422,2413.31,11.87
"fpd2","fpd","forest podocarpus disturbed","disturbed",2996,1936.32,9.01
"fpd3","fpd","forest podocarpus disturbed","disturbed",2792,2116.01,9.72
"fpd4","fpd","forest podocarpus disturbed","disturbed",2819,2097.9,9.79
"fpo1","fpo","forest podocarpus","undisturbed",2833,2039.28,9.42
"fpo2","fpo","forest podocarpus","undisturbed",2937,2018.97,9.27
"fpo3","fpo","forest podocarpus","undisturbed",3009,1946.3,8.96
"fpo4","fpo","forest podocarpus","undisturbed",2753,2136.04,9.92
"fpo5","fpo","forest podocarpus","undisturbed",2825,2037.86,10.33
"gra0","gra","grassland","disturbed",1732,2024.49,16.99
"gra1","gra","grassland","disturbed",1742,2021.98,16.52
"gra2","gra","grassland","disturbed",1754,1904.51,17.64
"gra3","gra","grassland","disturbed",1474,1504.93,19.18
"gra4","gra","grassland","disturbed",1314,1369.38,20.39
"gra5","gra","grassland","disturbed",1266,1247.62,20.82
"gra6","gra","grassland","disturbed",1384,1450.29,21.64
"hel1","hel","alpine helichrysum vegetation","undisturbed",3849,1411.07,5.33
"hel3","hel","alpine helichrysum vegetation","undisturbed",4283,1287.43,2.9
"hel4","hel","alpine helichrysum vegetation","undisturbed",4396,1247.04,4.57
"hom1","hom","chagga homegarden","disturbed",1658,1939.49,17.03
"hom2","hom","chagga homegarden","disturbed",1171,1152.21,20.3
"hom3","hom","chagga homegarden","disturbed",1824,2244.09,16.23
"hom4","hom","chagga homegarden","disturbed",1300,1341.6,20.75
"hom5","hom","chagga homegarden","disturbed",1530,1604.28,19.22
"mai1","mai","maize field","disturbed",1008,784.85,22.56
"mai2","mai","maize field","disturbed",872,590.29,24.78
"mai4","mai","maize field","disturbed",962,714.43,23.64
"mai5","mai","maize field","disturbed",953,693.4,23
"sav1","sav","savannah","undisturbed",883,657.02,24.58
"sav2","sav","savannah","undisturbed",1028,821.72,24.18
"sav3","sav","savannah","undisturbed",1139,956.77,22.32
"sav4","sav","savannah","undisturbed",963,706.97,23.86
"sav5","sav","savannah","undisturbed",943,678.5,23.67
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
"animal_species","bill_width","body_mass","kipps_index","kipps_distance","wing_length"
"Amadina fasciata",8.478,18,0.266,17.375,65.375
"Anaplectes rubriceps",8.843,22.57,0.195,16.25,83.375
"Andropadus importunus",8.768,27.4,0.108,9.25,85.625
"Andropadus milanjensis",10.11,37.38,0.156,15.375,98.625
"Andropadus nigriceps",9.583,32.8,0.138,12.875,93.625
"Apalis flavida",5.746,8.19,0.095,4.75,49.75
"Apaloderma vittatum",16.613,55,0.383,46.5,121.5
"Aplopelia larvata",7.085,155,0.291,42.667,146.667
"Batis molitor",7.365,11.64,0.146,8.625,59.25
"Bradypterus cinnamomeus",7.41,17.39,0.098,6.25,64
"Bradypterus lopezi",7.71,19.15,0.124,7.625,61.5
"Bycanistes brevis",41.748,1232.84,0.24,83.375,347.75
"Chloropeta similis",7.203,11.1,0.116,7,60.375
"Chrysococcyx klaas",10.24,27.37,0.34,33,97.125
"Cichladusa guttata",8.653,23.11,0.108,9.05,84
"Cinnyricinclus femoralis",10.78,45.87,0.247,24,97
"Cinnyricinclus leucogaster",11.57,44,0.314,33,105
"Cinnyricinclus sharpii",10.823,41,0.28,28.375,101.5
"Colius striatus",10.43,51.1,0.223,21.125,94.875
"Columba arquatrix",9.015,400,0.372,83.75,225.375
"Columba delegorguei",8.66,133,0.351,61.25,174.625
"Corvus albicollis",27.603,893.99,0.373,146.15,391.625
"Corythaixoides leucogaster",19.763,216.16,0.149,33.125,223
"Cossypha caffra",7.68,28.5,0.139,11.125,80.25
"Coturnix coturnix",9.455,96.28,0.422,46.5,110.25
"Dioptrornis fischeri",9.595,23.4,0.134,11.75,87.625
"Emberiza flaviventris",8.13,18.24,0.214,17.75,82.875
"Emberiza tahapisi",6.978,12.98,0.202,15.25,75.625
"Euplectes capensis",8.975,30.51,0.143,9.375,65.5
"Francolinus sephaena",12.47,340.47,0.204,28.333,139
"Francolinus squamatus",12.978,449.45,0.173,30.75,177.25
"Hippolais languida",7.638,12,0.251,18.625,74.125
"Irania gutturalis",9.567,21.6,0.237,22,93
"Lamprotornis chalybaeus",10.265,86.17,0.248,34.083,137.417
"Lamprotornis corruscus",11.381,56.07,0.23,24.688,107.25
"Lamprotornis superbus",11.433,64.9,0.277,33.875,122.25
"Linurgus olivaceus",8.917,20.3,0.193,14,72.667
"Lybius leucocephalus",16.096,62.79,0.177,16.846,95.231
"Lybius melanopterus",14.93,52.4,0.121,11.125,91.625
"Monticola saxatilis",11.605,50.3,0.338,40,118.5
"Nigrita canicapillus",7.363,18.7,0.197,13.25,67.25
"Oenanthe oenanthe",7.52,25.39,0.338,31.375,92.75
"Oenanthe pleschanka",7.373,19.36,0.295,27.625,93.5
"Onychognathus morio",16.223,132.9,0.252,40.167,159.667
"Onychognathus walleri",14.845,93,0.293,38.375,131.125
"Oriolus larvatus",14.47,66.1,0.273,36.75,134.375
"Passer griseus",7.548,27.82,0.214,17.25,80.75
"Petronia pyrgita",7.11,24.1,0.234,21.125,90.125
"Phyllastrephus cabanisi",9.678,34.4,0.131,10.75,82
"Phyllastrephus strepitans",7.38,27.1,0.089,7.25,81.875
"Phylloscopus umbrovirens",5.95,8.6,0.146,9,61.5
"Ploceus baglafecht",10.133,211,0.16,12.875,80.25
"Ploceus intermedius",8.265,20.58,0.206,14.625,70.875
"Ploceus nigricollis",9.681,27.1,0.152,11.438,75.125
"Ploceus ocularis",8.463,25.2,0.141,10.286,73
"Ploceus rubiginosus",8.755,29.99,0.207,16.5,79.875
"Poeoptera kenricki",10.805,46.37,0.289,30.125,104.125
"Pogoniulus leucomystax",7.78,11.8,0.156,8.625,55.125
"Pogoniulus pusillus",7.093,9.6,0.11,6,54.625
"Pogonocichla stellata",7.892,18.6,0.162,12.7,78.4
"Poicephalus rufiventris",14.253,120,0.36,55.5,154.375
"Pseudoalcippe abyssinica",9.605,18.8,0.107,7.25,67.875
"Pycnonotus barbatus",9.058,32.1,0.164,15.875,96.75
"Serinus citrinelloides",6.21,12.99,0.211,14,66.5
"Serinus mozambicus",7.34,11.87,0.225,15.25,67.75
"Serinus striolatus",7.708,22.4,0.154,10.375,67.5
"Stactolaema leucotis",13.588,54.9,0.199,18.125,90.875
"Streptopelia semitorquata",7.663,176,0.351,60.25,171.75
"Sylvia atricapilla",7.208,16.7,0.276,21.375,77.375
"Sylvia borin",7.545,18.2,0.307,24.236,78.864
"Sylvia communis",6.858,15.1,0.247,18.25,74
"Tauraco hartlaubi",13.118,224,0.051,8.625,170.75
"Tockus alboterminatus",24.884,223.65,0.191,43.857,229.929
"Tockus deckeni",23.77,167.72,0.166,29.6,178.8
"Tockus erythrorhynchus",21.128,138.56,0.185,32.25,174.75
"Tockus nasutus",26.404,179.56,0.226,47.714,211.286
"Trachyphonus erythrocephalus",13.91,63.5,0.114,11.063,96.688
"Treron calvus",10.15,197.53,0.38,63.75,167.875
"Tricholaema lacrymosa",10.735,22.9,0.143,10,70
"Turdoides rubiginosa",10.26,40.6,0.078,6.667,85.667
"Turdus olivaceus",10.904,67.29,0.178,19.8,111.1
"Urocolius macrourus",11,45.5,0.29,26,89.75
"Zoothera piaggiae",11.473,51.1,0.199,20.75,104.125
"Zosterops abyssinicus",5.053,9.43,0.209,11.2,53.6
"Zosterops poliogastrus",6.258,12,0.176,10.4,59
Loading

0 comments on commit affbd28

Please sign in to comment.