Abstract
The R-package dendroNetwork aims to make network analyses of dendrochronological data accessible for researchers. dendroNetwork enables researchers to easily construct a network of dendrochronological series based on the similarity and find patterns of matching tree-ring material. The detection of patterns is assisted by the easy application of community detection and subsequent (automated) visualization using Cytoscape. This enables dendrochronologists and other researchers to apply networks analyses to understand patterns of similarity between tree-ring series.Dendrochronological analyses are often based on the comparison of tree-ring series with other tree-ring series. These comparions are often visualised as tabular data. However, to analyse the complex system of relations between tree-ring curves other methods are necessary. The author has developed a method to analyse patterns of similarity between tree-ring series using network analysis (Visser, 2021a; Visser & Vorst, 2022). The analyses of these papers was mostly based on scripts that are shared with the papers (Visser, n.d., n.d.). For others to apply the developed method with these scripts is possible, but cumbersome and various things need to be changed. In addition, to try the network approach on dendrochronological data for the first time can be overwhelming an seemingly difficult. To make this more easy and accessible a new package for R has been designed to help users to apply this method to their data. The package dendroNetwork enables researchers to create tables with the similarity using various measures and visualize these using R (R Core Team, 2022) and Cytoscape (Otasek, Morris, Bouças, Pico, & Demchak, 2019; Shannon et al., 2003). Cytoscape is an open source and platform independent tool for network analysis and visualization. The software provides easy visual access to complex networks and the attributes of both nodes and edges in a network. The dendroNetwork package has been reviewed on ROpenSci (https://github.com/ropensci/dendroNetwork and https://docs.ropensci.org/dendroNetwork/).
There are several packages available in R for dendrochronological research (Alday, Shestakova, Resco de Dios, & Voltas, 2018; Altman, Fibich, Dolezal, & Aakala, 2014; Bunn, 2008; Campelo, García-González, & Nabais, 2012; Campelo, Mayer, & Grabner, 2019; Guiterman, Lynch, & Axelson, 2020; Haneca, 2023; Jevšenak & Levanič, 2018; Maaten-Theunissen, Maaten, & Bouriaud, 2015; Malevich, Guiterman, & Margolis, 2018; Rademacher et al., n.d.; Reynolds, Edge, & Black, 2021; Shi, Xiang, Liu, & Shah, 2019). An overview with links to these packages can be found online (https://ronaldvisser.github.io/Dendro_R/). Some packages are specifically creates to obtain measurements (Campelo et al., 2019; Shi et al., 2019), while others are written for crossdating (Reynolds et al., 2021). There are also various for analysing tree-ring data (Alday et al., 2018, 2018; Altman et al., 2014; Bunn, 2008; Campelo et al., 2012; Guiterman et al., 2020; Zang & Biondi, 2015). These R-packages in dendrochronology all fill different needs, but the nice thing is that these are all interconnected in some way in depending on each other, or that they build further into different avenues. Apart from depending on dendrochronological packages, various packages from the Tidyverse (Wickham et al., 2019) are often also needed. The various relations can easily be visualised using a network, with the edges based on the dependency of two packages on each other, and and arrow indicating the direction of the dependency. Some R-package for dendrochronology or tree-ring studies have no relation with others, but fill specific needs (Aryal, Häusser, Grießinger, Fan, & Bräuning, 2020; Campelo, Nabais, Carvalho, & Vieira, 2016; Lara, Bogino, & Bravo, 2018; Peters et al., 2018). These are left out of the network (see Figure 1).
Figure 1: The interdependent relations between existing R-packages related to dendrochronology
The network shows that nearly all packages depend on dplR (Bunn, 2008). The newly created package dendroNetwork fits in this ecosystem of depending packages, since it depends on both dplR and the Tidyverse. In addition, it adds a whole new world by adding network analyses through igraph (Csardi & Nepusz, 2006) to the ecosystem of dendrochronological packages. The igraph library has close connections to the tidyverse, creating a full circle and filling a gap as shown in the networks below (see Figure 2).
Figure 2: The interdependent relations between R-packages including dendroNetwork. On the left only the dependencies for dendroNetwork, on the right all dendrochronological R-packages, including dendroNetwork
The typical workflow when using the package consists of a number of successive steps (see Figure 3). The result of each step is input for the next step.
Figure 3: The typcial workflow when using dendroNetwork to visualise a network
This first step is to load the package and subsequently the dendrochronological data into the R environment using dplR:
library(dendroNetwork)
data(hol_rom)
The next step would involve calculating the similarities between each tree-ring series in the dataset.
sim_table_hol <- sim_table(hol_rom)
In the next step edges of the network are created based on the similarity. Each similarity between two curves above certain threshold settings will result in an edge in the network. The default settings are 0.5 for the correlation, 0.7 for the Synchronous Growth Changes or sgc (Visser, 2021b) with a probability of exceedence below 0.0001.
g_hol <- dendro_network(sim_table_hol)
The next steps will be to find communities using either the Girvan-Newman algorithm (Girvan & Newman, 2002) or clique percolation method (Palla, Derenyi, Farkas, & Vicsek, 2005) , or both.
g_hol_gn <- gn_names(g_hol)
g_hol_cpm <- clique_community_names(g_hol, k=3)
hol_com_cpm_all <- find_all_cpm_com(g_hol)
The next step is to visualize and explore the networks using Cytoscape or using R (see Figure 4). Various functions are available to create visual styles for the communities in Cytoscape from R.
Figure 4: Network of the dendrochronological site chronologies in hol_rom
The main advantage is that visualisation in Cytoscape is more easy, intuitive and visual. In addition, it is very easy to automate workflows in Cytoscape with R (using RCy3). For this purpose we need to start Cytoscape firstly. After Cytoscape has completely loaded, the next steps can be taken.
cyto_create_graph(g_hol, CPM_table = hol_com_cpm_all, GN_table = g_hol_gn)
cyto_clean_styles()
once in a session.cyto_create_cpm_style(g_hol, k=3, com_k = g_hol_cpm)
igraph::clique_num(g_hol)
.for (i in 3:igraph::clique_num(g_hol)) { cyto_create_cpm_style(g_hol, k=i, com_k = g_hol_cpm)}
.Figure 5: The network of Roman sitechronologies with the Girvan-Newman communities visualized using Cytoscape.
The new R package dendroNetwork has been developed based on earlier research by the author. To enable other researchers to use network analyses on dendrochronological data this new package fills a gap that exists in the current network of R-packages related to dendrochronology by also connecting igraph to the existing packages in the discipline. The creation of networks in R is made easy with various functions and the visualization in Cytoscape is automated in R, enabling the researcher to quickly visualise and analyse the resulting networks in an intuitive manner. The package is easy to use and enables reproducible network analyses within dendrochronology.
This package was mostly created in my spare time and I’d like to thank my family for bearing with me. I want to thank Angelino Salentino for creating the orginal function for clique_community_names() and lique_community_names_par(), which I adapted for use in this package (source: https://github.com/angelosalatino/CliquePercolationMethod-R. I want to thank Andy Bunn for the function cor.with.limit.R() which I adapted for use in this package as cor_mat_overlap() (source: https://github.com/AndyBunn/dplR/blob/master/R/rwi.stats.running.R).