move things around

This commit is contained in:
aaron
2024-03-12 14:02:41 +01:00
parent 1163836de6
commit 132857445e
5 changed files with 1910 additions and 2 deletions

View File

@@ -0,0 +1,40 @@
---
title: "ironwood project"
output: html_notebook
---
First lets assess the health of the population.
```{r}
# read a data frame from the ods document
df <- read_ods("../data/ironwood_data_cleaned.ods", sheet = 1)
# site base location
site_lat <- "-33.943917"
site_lon <- "23.507389"
# vector of condition names corresponding to the health index numbers
condition_names <- c("healthy", "light damage",
"medium damage", "severe damage",
"at point of death")
# colors for each condition
condition_colors <- c("green", "yellow", "orange", "red", "black")
# Calculate the percentage of trees in each health condition
percentage <- proportions(table(df$tree_health_index)) * 100
# Now, let's create the bar plot
barplot(percentage,
names.arg = condition_names,
main = "Overview of Tree Health Index",
xlab = "Health Index",
ylab = "Percentage of Trees",
ylim = c(0, max(percentage) + 10),
col = condition_colors,
border = "black")
# Adding a legend
legend("topright",
legend = condition_names,
fill = condition_colors)
# Add labels with the percentage of trees in each bar
text(x = barplot(percentage, plot = FALSE),
y = percentage,
labels = paste0(round(percentage, 1), "%"),
pos = 3)
```

File diff suppressed because one or more lines are too long