Skip to content

Commit

Permalink
[CFFDRS R FR]: Make named lists rather than 2 calls to the same object
Browse files Browse the repository at this point in the history
Fixes #34
  • Loading branch information
BadgerOnABike committed Sep 19, 2024
1 parent d87aa0a commit e4702d3
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions R/crown_base_height.r
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
crown_base_height <- function(FUELTYPE, CBH, SD, SH) {
# logic originally in fbp() pulled into its own function
CBHs <- c(
2, 3, 8, 4, 18, 7, 10,
0, 6, 6, 6, 6, 0, 0, 0, 0, 0
)
names(CBHs) <- c(
"C1", "C2", "C3", "C4", "C5", "C6", "C7",
"D1", "M1", "M2", "M3", "M4", "S1", "S2", "S3", "O1A", "O1B"
)
CBHs <-c(
"C1" = 2,
"C2" = 3,
"C3" = 8,
"C4" = 4,
"C5" = 18,
"C6" = 7,
"C7" = 10,
"D1" = 0,
"M1" = 6,
"M2" = 6,
"M3" = 6,
"M4" = 6,
"S1" = 0,
"S2" = 0,
"S3" = 0,
"O1A" = 0,
"O1B" =0)

CBH <- ifelse(
CBH <= 0 | CBH > 50 | is.na(CBH),
ifelse(
Expand Down

0 comments on commit e4702d3

Please sign in to comment.