When a factor trait is given to fb_plot_trait_correlation() the function errors and mustn't recognize it as a non-numerical traits.
The function should only keep numerical traits.
Reproducible example
# Trait as factor
my_traits = data.frame(
species = paste0("sp", 1:26),
trait1 = 1:26,
trait2 = factor(letters),
trait3 = LETTERS,
trait4 = 26:1
)
funbiogeo::fb_plot_trait_correlation(my_traits)
#> Non-numerical traits found, only keeping numerical traits to show trait correlation
#> Error in stats::cor(x[, -1, drop = FALSE], use = "complete.obs", ...): 'x' doit être numérique
funbiogeo::fb_plot_trait_correlation(my_traits[, -3])
#> Non-numerical traits found, only keeping numerical traits to show trait correlation
Bug description
When a factor trait is given to
fb_plot_trait_correlation()
the function errors and mustn't recognize it as a non-numerical traits. The function should only keep numerical traits.Reproducible example
Created on 2024-04-02 with reprex v2.1.0