The following code simulate a number of phylogenetic trees(here 100). But due to chance event of extinction some trees are NULL. I need to verify those NULL trees, drop them from the output object and select x out of N trees from the remaining trees.
library(phytools)
Trees<- pbtree(b=0.6, d=0.2, n=200, t=NULL, scale=NULL, nsim=100, type="continuous", extant.only=TRUE)
Suppose above code returns 3 NULLs and I need to (let's say) choose 50 out of 100-3=97 trees. It can be the first 50 trees or whatever. I'm not sure if a loop can do that for me.
Thanks for your help!