As part of developing a demo for the package I'm working on, I need to quantify the ecological food web as described below. I checked vegan, bipartisan and sleep, but I see nothing that does what I need, although I can be wrong - these are large packages. So I'm wondering if this idea is already in the package, or if someone has a smart way to calculate the results. It looks like it should be a package.
The food web can be described by a matrix of interactions between A: F species, as shown in the code and diagram. In words, we can say that "A eats B, which eats E", etc. (It is very difficult to see in the matrix, trivial in the diagram).
species <- LETTERS[1:6] links <- c(0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0) L <- matrix(links, nrow = 6, byrow = TRUE, dimnames = list(species, species))
I want to calculate the trophic position and trophic height of each species. The trophic position is defined as the total number of species in the food chain below a certain species + 1. In the diagram, the trophic position A is 6, and for D it is 3. On the other hand, the trophic height is average about the position of the species in each individual chain in which it involved. Species B is connected to 4 different chains (tracks); its height is the average of the considered positions at the time: (3 + 3 + 3 + 2) / 4 = 2.75.
It is computable to calculate, you need to read the matrix L, and then work through the various paths implied by the matrix to calculate the necessary values.
If this is not too stupid, does anyone know a package that will do this, or look at a way to track paths and compute at different lengths / parameters? It โfeelsโ as if there should be some kind of recursive / applied approach that should work, but I don't want to invent material.
Thanks at Advance