# Example: Estimating WS using DBH = 30 cm and tree height = 15 m
d <- 30 # Stem Diameter at Breast Height in cm
h <- 15 # Tree Height in meters
WS_result <- WS(d, h)
print(WS_result)
# Example: Handling missing or zero values
d <- NA # Stem Diameter at Breast Height in cm
h <- 15 # Tree Height in meters
WS_result <- WS(d, h)
print(WS_result) # Should return NA because DBH is NA
d <- 0 # Stem Diameter at Breast Height in cm
h <- 15 # Tree Height in meters
WS_result <- WS(d, h)
print(WS_result) # Should return 0 because DBH is 0
Run the code above in your browser using DataLab