I've got the Error: std::bad_alloc
error when trying to use a for loop:
trees <- as.multiPhylo(for ( i in 1:100 ) { rand_tip(my.input, tree, forceultrametric = TRUE, prune = FALSE) })
The weird thing is, I used the rand_tip function before without any problem, then I tried this loop and got this error, and then I tested the function without the loop and got the same error! I'm pretty sure this is not a memory problem.
Does anybody know what's going on?
I'm editing a phylogenetic tree (object class LargePhylo) by adding missing species on it (using the rand_tip function). I used this function to do it before and it worked well. But now I need to do it many times, so I used the loop. After using it I receive the message that the function start to work (as normally) but then I got this std::bad_alloc
error.
> trees <- as.multiPhylo(for ( i in 1:100 ) {
+ rand_tip(my.input, tree, forceultrametric = TRUE, prune = FALSE)
+ })
***************************************************************
* Note: *
* force.ultrametric does not include a formal method to *
* ultrametricize a tree & should only be used to coerce *
* a phylogeny that fails is.ultramtric due to rounding -- *
* not as a substitute for formal rate-smoothing methods. *
***************************************************************
Error: std::bad_alloc
When trying to run the function again, without the loop, I keep receiving the same error.
> new.tree <- rand_tip(my.input, tree, forceultrametric = TRUE, prune = FALSE)
***************************************************************
* Note: *
* force.ultrametric does not include a formal method to *
* ultrametricize a tree & should only be used to coerce *
* a phylogeny that fails is.ultramtric due to rounding -- *
* not as a substitute for formal rate-smoothing methods. *
***************************************************************
Error: std::bad_alloc