From scripts to package. Developing dendroNetwork and learning with rOpenSci

[This article was first published on rOpenSci - open tools for open science, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Developing dendroNetwork as a package was not a goal from the beginning, but looking back, I think that it should have been. I wish someone had suggested making a package to me much earlier. Why? Because of many things, but mostly: reproducibility and transparency. This enables others to also use the method and software. In addition, I really enjoyed the open peer-review process after submitting to rOpenSci, because the reviewers showed me various improvements and how people from outside my discipline viewed the software and documentation. Meeting new people is always nice and a great bonus of the process.

A few years ago I published a method developed to explore patterns in the similarity between tree-ring series using network analysis.1 In dendrochronology the pair-wise comparison of tree-ring series is an often used method to look for patterns in, for example, the provenance of the wood, especially for archaeological wood, since we often know where the wooden objects came from, but not where the trees were felled. This type of study often results in a complex set of relations and I think that network analysis is a great method for visualising and analysing these relations without losing the complexity. I developed this method and shared the code with my publication.2 Part of the code had been written by others and adapted for the analyses. The fact that Angelo Salatino (The Open University) shared his code openly and Andy Bunn (Western Washington University) did the same, shows how beneficial openly sharing code is to others and for the progress of research. Further research was performed, refining the method and exploring other avenues, such as looking at wood use within a Roman ship and the provenance of wood used in these ships.3 Later, I read a blog post about packaging and how easy it could be. Unfortunately, I do not remember which blog it was, but it inspired me to convert my code into a package, for the benefit of others, but also because I wanted to learn how to do this.

For me, creating a package from my existing scripts started with these three excellent resources (in random order):

The easy bit was converting scripts into functions, since this is pretty straight forward programming. However, I never realized how much work writing (good) documentation is. This took me much longer than I expected, also because I was (and am) doing this in my spare time. However, it was also worthwhile to do this and explain what the functions and variables are for. I also learned a lot about the potential for continuous integration, automated testing and checking, especially from the rOpenSci-documentation. A lot of information can be found there, which is really helpful. It takes an effort to read everything, but in the end it can save you a lot of time if you read it before you start developing a package!

I really enjoyed the open peer-review process. After reading all the documentation and making sure that dendroNetwork complied to the standards of rOpenSci, the process of submission was very easy. I enjoyed the feedback I got from the reviewers Kaija Gahm and Zachary Gajewski and their comments really improved the software in a whole.

I would recommend any research who develops a new method with code to do the following things:

  • Be nice, and share and document your code!

  • Develop functions not scripts.

  • Develop a package from the start, especially when devising a new method(ology).

  • Read the documentation (or: RTFM)

  • Submit to rOpenSci and enjoy!

  1. Visser, R. M. (2021). Dendrochronological Provenance Patterns. Network Analysis of Tree-Ring Material Reveals Spatial and Economic Relations of Roman Timber in the Continental North-Western Provinces. Journal of Computer Applications in Archaeology, 4(1), 230. ↩︎

  2. Visser, R. M. (2022). Dendrochronological Provenance Patterns. Code and Data of Network Analysis of Tree-Ring Material [dataset]. ↩︎

  3. Visser, R. M., & Vorst, Y. (2022). Connecting Ships: Using Dendrochronological Network Analysis to Determine the Wood Provenance of Roman-Period River Barges Found in the Lower Rhine Region and Visualise Wood Use Patterns. International Journal of Wood Culture, 3(1-3), 123-151.

    Visser, R., & Vorst, Y. (2022). Analyses, data and figures related to: ‘Connecting ships: using dendrochronological network analysis to determine the wood provenance of Roman-period river barges found in the Lower Rhine region and to visualise patterns of wood use’ [dataset]. ↩︎

To leave a comment for the author, please follow the link and comment on their blog: rOpenSci - open tools for open science. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)