This is just a demo post. The idea is to test the capabilities of Distill as a blogging platform. In this post I am just trying out a few capabilities of Distill and how well it is suited to the kinds of things I would like to write about. Amongst other things. However, time will tell on how well I can focus on writing articles here.

There are a few reasins for why I would like to try Distill as my blogging platform. As I want to write more things of scientific nature I would like to be able to easily cite articles. For example later in this example page I use volume functions from the article *Single-tree biomass and stem volume functions for eleven tree species used in Icelandic forestry* (Arnór Snorrason and Stefán Freyr Einarsson 2006).

Other reasons are the capabilities of working with the data right in the blogging system and creating the charts and tables in the same area as I write the post.

For example we have the following data that I would like to work with.

First I would like to do basic manipulation of the data.

```
trees$dbh <- (trees$diam1 + trees$diam2) / 2
trees$ba = (trees$dbh/200)^2 * pi
```

For the next trick we use linear regressions to calculate the expected height of the trees. We then use `coalesce()`

to copy back the height we already knew. From there we can calculate the volume of each tree using the volume functions (Arnór Snorrason and Stefán Freyr Einarsson 2006).

Using LaTeX math symbols we can communicate mathematical functions in a nice manner. For example we can talk about BAL as described by Arne Pommerening’s excellent article *Basal area in larger trees and the growth compensation point* where he explains BAL as such:

BALis related to available light, since with increasing basal area of larger trees there is less light available for smaller trees. In a senseBALis a surrogate for light measurements with the benefit that stem diameters and basal area are easier to measure.

\[BAL_i(t) = G(t) \cdot (1 - p_i(t)) \text{ where } p_i(t) = \frac{1}{G(t)} \sum_{\leq g_i(t)} g_i(t)\]

He also give us an example function in R. Let us use it to calculate the BAL of individual trees in our example data.

```
bal <- function(ba, area) {
sumba <- sum(ba)
basmaller <- 0
pix <- 0
bal <- 0
for (i in 1 : length(ba)) {
bax <- ba[i]
basmaller <- sum(ba[ba <= bax])
pix <- basmaller / sumba
bal[i] <- sumba * (1 - pix) / area
}
return(bal)
}
# An then run it for out 0.54ha example stand.
trees$bal <- bal(trees$ba, 0.54/10000)
```

Arnór Snorrason, and Stefán Freyr Einarsson. 2006. “Single-Tree Biomass and Stem Volume Functions for Eleven Tree Species Used in Icelandic Forestry.” *Icelandic Agricultural Sciences*, 15–24. https://www.semanticscholar.org/paper/Single-tree-biomass-and-stem-volume-functions-for-Snorrason-Einarsson/6668a0d8e81f7c32c0a0926d99b3451c9c69c160.

If you see mistakes or want to suggest changes, please create an issue on the source repository.