Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single data point causes BAB function to return error #163

Open
spetersongit opened this issue Mar 8, 2024 · 0 comments
Open

Single data point causes BAB function to return error #163

spetersongit opened this issue Mar 8, 2024 · 0 comments

Comments

@spetersongit
Copy link

Hello,

I'm doing a class project for undergrads where they collect morphological data on plants and use phangorn to create phylogenetic trees from their matrix of data. I decided for ease of data collection to have all categories be binary traits. Sometimes, there is a single cell of data which throws an error when using the bab() function:

Error in *tmp*[[i]] : subscript out of bounds

If I change that single cell from a 1 to a 0, the program can make trees.

An example dataset that throws the error is attached here
MorphData.csv
. The error is linked to cells 8, 14 or 9, 14 (Linear_S variable, Species 7 & 8). If I change either 1 in that column to a 0, this set of traits will work. Otherwise it fails.

The code I am using is:
morph_data = read.csv(MorphData.csv, row.names = 1)

#Reformat the data to be useful for tree analysis
morph_data = phyDat(as.matrix(morph_data), type = "USER", levels = 0:1)

#Create a set of candidate trees using the Branch and Bound algorithm
morph_cand = bab(morph_data, trace = 0)

The error occurs in the bab() line.

Any help tracking down what might be happening would be huge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant