Skip to content

Commit

Permalink
fix clade
Browse files Browse the repository at this point in the history
  • Loading branch information
xieshu95 committed Oct 16, 2024
1 parent feed00a commit 0707248
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions R/DAISIE_ONEcolonist.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ DAISIE_ONEcolonist_trait <- function(time,
all_colonisations = list(),
num_state1 = c(),
num_state2 = c(),
clade = list())
clade = c())

# Get branching and colonisation times
btimes_all_clado_desc <- rev(
Expand Down Expand Up @@ -271,9 +271,19 @@ DAISIE_ONEcolonist_trait <- function(time,
col_times <- col_times[-i_youngest_col_time]

descendants$branching_times <- c(time, col_times)
clade <- island_spec[-i_youngest_col_btimes,]
clade <- island_spec[-i_youngest_col_time,]
}
if (!is.matrix(clade)) {
clade <- rbind(clade[1:8])
colnames(clade) <- c("Species",
"Mainland Ancestor",
"Colonisation time (BP)",
"Species type",
"branch_code",
"branching time (BP)",
"Anagenetic_origin",
"trait_state")
}

descendants$num_state1 <- sum(clade[,"trait_state"] == 1)
descendants$num_state2 <- sum(clade[,"trait_state"] == 2)
descendants$clade <- clade
Expand Down

0 comments on commit 0707248

Please sign in to comment.