knitr::opts_chunk$set(echo = TRUE)

pacman::p_load(tidyverse)

Data Import

Soil Summary

summary(soil_data)
##    Event_ID           unique_id         Type           soil_order_mode
##  Length:36819       Min.   :    1   Length:36819       Min.   : 1.00  
##  Class :character   1st Qu.: 2074   Class :character   1st Qu.: 4.00  
##  Mode  :character   Median : 4096   Mode  :character   Median :10.00  
##                     Mean   : 4947                      Mean   : 7.82  
##                     3rd Qu.: 6643                      3rd Qu.:10.00  
##                     Max.   :20087                      Max.   :11.00  
##                                                        NA's   :773    
##    awhc_mean      drainage_class_mode  hydgrp_mode    soil_order1_prop 
##  Min.   : 7.282   Min.   :1.000       Min.   :1.000   Min.   :0.00000  
##  1st Qu.:20.441   1st Qu.:2.000       1st Qu.:2.000   1st Qu.:0.00000  
##  Median :24.940   Median :5.000       Median :3.000   Median :0.00000  
##  Mean   :23.986   Mean   :5.193       Mean   :3.619   Mean   :0.07047  
##  3rd Qu.:28.774   3rd Qu.:8.000       3rd Qu.:5.000   3rd Qu.:0.00000  
##  Max.   :61.262   Max.   :8.000       Max.   :7.000   Max.   :1.00000  
##  NA's   :773      NA's   :773         NA's   :773                      
##  soil_order2_prop soil_order3_prop soil_order4_prop  soil_order5_prop
##  Min.   :0        Min.   :0        Min.   :0.00000   Min.   :0       
##  1st Qu.:0        1st Qu.:0        1st Qu.:0.00000   1st Qu.:0       
##  Median :0        Median :0        Median :0.00000   Median :0       
##  Mean   :0        Mean   :0        Mean   :0.05529   Mean   :0       
##  3rd Qu.:0        3rd Qu.:0        3rd Qu.:0.00000   3rd Qu.:0       
##  Max.   :0        Max.   :0        Max.   :1.00000   Max.   :0       
##                                                                      
##  soil_order6_prop   soil_order7_prop   soil_order8_prop soil_order9_prop 
##  Min.   :0.000000   Min.   :0.000000   Min.   :0        Min.   :0.00000  
##  1st Qu.:0.000000   1st Qu.:0.000000   1st Qu.:0        1st Qu.:0.00000  
##  Median :0.000000   Median :0.000000   Median :0        Median :0.00000  
##  Mean   :0.008889   Mean   :0.004301   Mean   :0        Mean   :0.02918  
##  3rd Qu.:0.000000   3rd Qu.:0.000000   3rd Qu.:0        3rd Qu.:0.00000  
##  Max.   :1.000000   Max.   :1.000000   Max.   :0        Max.   :1.00000  
##                                                                          
##  soil_order10_prop soil_order11_prop  soil_order12_prop
##  Min.   :0.0000    Min.   :0.000000   Min.   :0        
##  1st Qu.:0.0000    1st Qu.:0.000000   1st Qu.:0        
##  Median :0.0000    Median :0.000000   Median :0        
##  Mean   :0.2923    Mean   :0.005325   Mean   :0        
##  3rd Qu.:1.0000    3rd Qu.:0.000000   3rd Qu.:0        
##  Max.   :1.0000    Max.   :1.000000   Max.   :0        
## 
# 1) Histogram of soil order
ggplot(soil_data, aes(x = soil_order_mode)) +
  geom_histogram(breaks = seq(0.5, 12.5, 1), fill = "steelblue", color = "black") +
  scale_x_continuous(breaks = 1:12) +
  labs(x = "Soil Order", y = "Count") +
  theme_minimal()
## Warning: Removed 773 rows containing non-finite outside the scale range
## (`stat_bin()`).

# 2) Histogram of average water holding capacity
ggplot(soil_data, aes(x = awhc_mean)) +
  geom_histogram(binwidth = 2, fill = "seagreen", color = "black") +
  labs(x = "Average Water Holding Capacity", y = "Count") +
  theme_minimal()
## Warning: Removed 773 rows containing non-finite outside the scale range
## (`stat_bin()`).

# 3) Histogram of drainage class mode
ggplot(soil_data, aes(x = drainage_class_mode)) +
  geom_histogram(breaks = seq(0.5, 8.5, 1), fill = "orange", color = "black") +
  scale_x_continuous(breaks = 1:8) +
  labs(x = "Drainage Class", y = "Count") +
  theme_minimal()
## Warning: Removed 773 rows containing non-finite outside the scale range
## (`stat_bin()`).

# 4) Histogram of hydrologic group mode
ggplot(soil_data, aes(x = hydgrp_mode)) +
  geom_histogram(breaks = seq(0.5, 7.5, 1), fill = "purple", color = "black") +
  scale_x_continuous(breaks = 1:7) +
  labs(x = "Hydrologic Group", y = "Count") +
  theme_minimal()
## Warning: Removed 773 rows containing non-finite outside the scale range
## (`stat_bin()`).

# 5) Histograms of soil order proportions
soil_long <- soil_data %>%
  select(starts_with("soil_order"), ends_with("_prop")) %>%
  pivot_longer(cols = everything(),
               names_to = "SoilOrder",
               values_to = "Proportion")

ggplot(soil_long, aes(x = Proportion)) +
  geom_histogram(binwidth = 0.1, fill = "dodgerblue", color = "black", boundary = 0) +
  scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1)) +
  labs(x = "Proportion", y = "Count") +
  facet_wrap(~ SoilOrder, ncol = 3, scales = "free_y") +
  theme_minimal()
## Warning: Removed 31552 rows containing non-finite outside the scale range
## (`stat_bin()`).

Topographic Roughness Index Summary

summary(tri_data)
##    Event_ID           unique_id         Type            TopoRougMean   
##  Length:36819       Min.   :    1   Length:36819       Min.   : 0.000  
##  Class :character   1st Qu.: 2074   Class :character   1st Qu.: 1.048  
##  Mode  :character   Median : 4096   Mode  :character   Median : 1.447  
##                     Mean   : 4947                      Mean   : 1.741  
##                     3rd Qu.: 6643                      3rd Qu.: 2.052  
##                     Max.   :20087                      Max.   :33.079
# Histogram of TRI values
ggplot(tri_data, aes(x = TopoRougMean)) +
  geom_histogram(binwidth = 5, fill = "coral", color = "black") +
  labs(x = "Mean Topographic Roughness Index (TRI)", y = "Count") +
  theme_minimal()

Elevation Summary

summary(elevation_data)
##    Event_ID           unique_id         Type              elevMean      
##  Length:36819       Min.   :    1   Length:36819       Min.   : -1.226  
##  Class :character   1st Qu.: 2074   Class :character   1st Qu.: 45.598  
##  Mode  :character   Median : 4096   Mode  :character   Median : 69.507  
##                     Mean   : 4947                      Mean   : 80.497  
##                     3rd Qu.: 6643                      3rd Qu.: 90.978  
##                     Max.   :20087                      Max.   :508.344
# Histogram of Elevation values
ggplot(elevation_data, aes(x = elevMean)) +
  geom_histogram(binwidth = 50, fill = "lightgreen", color = "black") +
  labs(x = "Mean Elevation (m)", y = "Count") +
  theme_minimal()