I've got the following problem:
I have to calculate the volume of specific trees. Therefore I need all the diametres and heights for each tree.
I put these variables then into land specific equations.
After that, I want to summarize all the data into one dataframe. But the results should have the land ID as well. At the moment I've come up with this solution:
volPs <- data.frame(
land = c("Sweden"),
dbh = c(dbhPs),
h = c(hPs),
calcVol = c(volSwedenPs)
)
volPs <- rbind(volPs, data.frame(land = "Estonia", dbh = c(dbhPs),
h = c(hPs), calcVol = c(volEstoniaPs)))
volPs <- rbind(volPs, data.frame(land = "Slovenia", dbh = c(dbhPs),
h = c(hPs), calcVol = c(volSloveniaPs)))
volPs <- rbind(volPs, data.frame(land = "Czech", dbh = c(dbhPs),
h = c(hPs), calcVol = c(volCzechPs)))
volPs <- rbind(volPs, data.frame(land = "Brandenburg", dbh = c(dbhPs),
h = c(hPs), calcVol = c(volBrandenburgPs)))
volPs <- rbind(volPs, data.frame(land = "Reported values",
dbh = c(dbhPs), h = c(hPs),
calcVol = c(df2$tv[df2$cts==codePs &
df2$dbh > 0 & df2$h > 0])))
volPs <- rbind(volPs, data.frame(land = "Austria",
dbh = c(dbhPs), h = c(hPs),
calcVol = c(volAustriaPs)))
As you can see, I create the data.frame with one set of data at first. And then adding land by land to get the land into the right set of data.
This works perfectly but I've got the feeling that this is a very bad way to solve this problem.
Is there a better way to merge the data while adding a land specific row as well?
Thank you guys in advance.