Ten years of forest change in Giżycko: BDL data in R
I used R to compare the 2015 and 2025 Forest Data Bank (BDL) records for the Giżycko Forest District, looking at species shares, age, height, DBH and volume in subcompartments that appear in both years.
This was the final assignment for the R programming module of my post-graduate programme in geoinformatics and AI in forestry. The task was to build a complete R workflow, from raw data to tables and figures. I did it with a fellow student, and we split the work evenly. The data came from the Polish Forest Data Bank (BDL) for the Giżycko Forest District, with one inventory from 2015 and one from 2025. We compared only the subcompartments that have the same forest address in both years.
Data and method
For each year I joined the subcompartment geometry (G_SUBAREA.shp) to the species-by-storey table (f_storey_species.txt). The join key was the plan position number (a_i_num). I kept only the tree layer and dropped species that occur only singly or in scattered patches. The two datasets were not built the same way: the 2015 shapefile holds only the ID and the geometry, while the 2025 one has many more attributes, which I had to remove.
The joined tables had about 20,000 rows (2015) and 21,000 rows (2025), with one row per species per subcompartment. Joining the two years directly gave a many-to-many table of about 50,000 rows that was hard to read. We therefore pivoted each year to a wide format, with one row per subcompartment and one column per species group. The groups were by genus: all oaks together, both alders, the pines, and poplars with aspen. Minor species went into an “other” group. We then added a 2025 − 2015 change column for each group.
From these tables we calculated:
- area per species group (share × subcompartment area) and the dominant species in each year, including where it changed;
- mean age, height and DBH, weighted by each species’ share rather than a plain average;
- total volume and growing stock (m³/ha), for the whole district and for each species group.
Result
The workflow writes 11 CSV tables, a set of faceted ggplot figures, and an interactive mapview map. On the map, the colour scale is centred so that white means zero change, and subcompartments whose dominant species changed have an outline.

Across the matching subcompartments, total volume rose by about 180,000 m³ and mean growing stock by about 10 m³/ha. Pine’s share of the area fell from 44.6% to 42.1%, oak’s rose from 7.8% to 10.1%, and beech grew from about 21 ha to 78 ha, most of it young stands.


What I learned
The main lesson was to settle the data structure before writing analysis code. Once I knew the cardinality of each join and chose a wide table per trait, every later step reused the same pattern. I also learned to check the source format rather than assume it stays the same between releases, and to think about which average actually fits the question. We used Claude Code for parts of the code, but the design, the species grouping and the interpretation were ours, and we went through and adapted every block.