I am trying to calculate phylogenetic signal using the phylosig function from phytools, but I get this error:
Error in vcv.phylo(tree) : the tree has no branch lengths
However, when I check my tree, it says it does have branch lengths!
> MCC_genus_tree
Phylogenetic tree with 1160 tips and 1159 internal nodes.
Tip labels:
Anolis, Ornithorhynchus, Zaglossus, Tachyglossus, Rhynchocyon, Elephantulus, ...
Rooted; includes branch lengths.
What is going on? Any help would be appreciated.
EDIT:
My tree is a MCC tree downloaded from vertlife.
The answer is I goofed. My data had no names, so phylosig dropped all my tips!
This is how I fixed it:
data_with_names <- data_without_names$trait
names(data_with_names) <- data_with_names$species_names
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.