diff --git a/ironwood_data_cleaned.ods b/data/ironwood_data_cleaned.ods similarity index 100% rename from ironwood_data_cleaned.ods rename to data/ironwood_data_cleaned.ods diff --git a/ironwood_data_original.ods b/data/ironwood_data_original.ods similarity index 100% rename from ironwood_data_original.ods rename to data/ironwood_data_original.ods diff --git a/ironwood_plots.R b/ironwood_plots.R index 1fd8985..1665161 100644 --- a/ironwood_plots.R +++ b/ironwood_plots.R @@ -12,12 +12,14 @@ library(leaflet) ## # read a data frame from the ods document -df <- read_ods("ironwood_data_cleaned.ods", sheet = 1) +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") +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") diff --git a/notebooks/ironwood_project_notebook.Rmd b/notebooks/ironwood_project_notebook.Rmd new file mode 100644 index 0000000..04404eb --- /dev/null +++ b/notebooks/ironwood_project_notebook.Rmd @@ -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) +``` diff --git a/notebooks/ironwood_project_notebook.nb.html b/notebooks/ironwood_project_notebook.nb.html new file mode 100644 index 0000000..23ed321 --- /dev/null +++ b/notebooks/ironwood_project_notebook.nb.html @@ -0,0 +1,1866 @@ + + + + + + + + + + + + + +ironwood project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

First lets assess the health of the population.

+ + + +
# 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)
+ + + +
LS0tCnRpdGxlOiAiaXJvbndvb2QgcHJvamVjdCIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKRmlyc3QgbGV0cyBhc3Nlc3MgdGhlIGhlYWx0aCBvZiB0aGUgcG9wdWxhdGlvbi4KCmBgYHtyfQojIHJlYWQgYSBkYXRhIGZyYW1lIGZyb20gdGhlIG9kcyBkb2N1bWVudApkZiA8LSByZWFkX29kcygiLi4vZGF0YS9pcm9ud29vZF9kYXRhX2NsZWFuZWQub2RzIiwgc2hlZXQgPSAxKQojIHN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