set.seed(4)
## A random tree with 15 tips
tree <- rcoal(15)
## setting up the parameters
my_rates = c(rgamma, rate = 10, shape = 5)
my_substitutions = c(runif, 2, 2)
## A Mk matrix (10*50)
matrixMk <- sim.morpho(tree, characters = 100, model = "ER",
states = c(0.85, 0.15), rates = my_rates, invariant = FALSE)
## Setting the number and source of inapplicable characters
my_inapplicables <- c(rep("character", 5), rep("clade", 5))
## Apply some inapplicable characters to the matrix
matrix <- apply.NA(matrixMk, my_inapplicables, tree, verbose = TRUE)
Run the code above in your browser using DataLab