I wanted to report a potential bug I found when using the latest version of phytools (2.1-1)
This is when I was trying to use phytools::plotTree.boxplot() with my own dataset.
> phytools::plotTree.boxplot(tree, xe~spp)
Error in boxplot.default(formula = list(A = list(), B = list(), C = list(), :
argument "x" is missing, with no default
Reproducible example
set.seed(123)
# Generate random tree with tips A-Z
tree <- rtree(26)
tree$tip.label <- LETTERS[1:26]
# Function to generate random data for each species
generate_species_data <- function(tree, n_points_per_species = 5) {
species_data <- list()
for (i in 1:Ntip(tree)) {
mean_val <- runif(1, min = 1, max = 10) # Random mean between 1 and 10
sd_val <- runif(1, min = 0.5, max = 2) # Random standard deviation between 0.5 and 2
species_data[[i]] <- rnorm(n_points_per_species, mean = mean_val, sd = sd_val)
}
return(species_data)
}
# Generate data for each tip
species_data <- generate_species_data(tree)
# Create data frame
species_df <- data.frame(Species = rep(tree$tip.label, each = 5), Value = unlist(species_data))
# Trait value
xe <- setNames(species_df$Value, species_df$Species)
spp <- factor(names(xe),untangle(ladderize(tree),"read.tree")$tip.label)
Hey Liam,
I wanted to report a potential bug I found when using the latest version of phytools (2.1-1) This is when I was trying to use phytools::plotTree.boxplot() with my own dataset.
Reproducible example
Tree:![image](https://github.com/liamrevell/phytools/assets/11167730/c39b3abd-ac69-445e-878f-51e820e0c7c4)
Session info:
For the moment I reverted to using the version in: http://blog.phytools.org/2016/07/update-to-plottreeboxplot-for-formula_25.html.
Thanks for your attention!