Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Russell Engelman
Dear Everyone, So this is really strange. I tried what Dr. Revell suggested, and for the two examples I gave it worked for *Cercopithecus albogularis*, but when I applied it to *Cricetomys ansorgei *I got the message... "Error in bind.tree(tree, tip, where = where, position = pp) : 'position'

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Liam J. Revell
Dear Russell. For some reason, my emails don't seem to be getting through to the whole list -- so my apologies if this ends up being redundant with another reply. In short, if you supply a vector of tip labels that are identical (e.g., c("Cricetomys_emini","Cricetomys_emini")),

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Mike Collyer
Hello Everyone, Just to stack onto Liam’s “fun with apply family of functions”, I often use lapply, which works well by having a function that only applies to the objects in a list, but often — and for difficult to decipher reasons — breaks down if the function is not predefined, is complex,

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Russell Engelman
Dear Everyone, So this is really strange. I tried what Dr. Revell suggested, and for the two examples I gave it worked for *Cercopithecus albogularis*, but when I applied it to *Cricetomys ansorgei *I got the message... "Error in bind.tree(tree, tip, where = where, position = pp) : 'position'

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Eliot Miller
Russell, If you're trying to do this across a lot of species, you're going to bump into a lot of complexities like this. I got the impression you were trying to do this for many species. For example, there's no reason that the taxon you're adding is, even if we assume monophyly of the clade

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Liam J. Revell
Dear Russell et al. (sorry if this is a re-send: my message yesterday seems to have been blocked by the listserv) Using a for loop is a great idea! Highly underrated in R, IMO. However, for future reference, the reason that your code didn't work with lapply is because the list you're

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Liam J. Revell
Dear Russell et al. Using a for loop is a great idea! Highly underrated in R, IMO. ;) However, for future reference, the reason that your code didn't work with lapply is because the list you're 'applying' over (tree) also appears among the arguments! If you want to use apply-family

Re: [R-sig-phylo] Using bind.tip and lapply on a multiPhylo object

2021-06-04 Thread Liam J. Revell
Dear Russell et al. (sorry if this is a re-send: my message yesterday seems to have been blocked by the listserv) Using a for loop is a great idea! Highly underrated in R, IMO. However, for future reference, the reason that your code didn't work with lapply is because the list you're