You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 boundsIf 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.
The text was updated successfully, but these errors were encountered: