daijiang / hillR

An R pakage to calculate diversity through Hill Numbers
Other
31 stars 14 forks source link

`hill_func` fails for all numeric traits #12

Closed FabianRoger closed 4 years ago

FabianRoger commented 4 years ago

take the following reproducible example:

library(hillR)
library(vegan)

BCI <- data(BCI, package = "vegan") 

ncol(BCI)

BCI_trait <- matrix(rnorm(ncol(BCI)*10, 5, 1), ncol = 10)
rownames(BCI_trait) <- colnames(BCI)

# fails
hillR::hill_func(BCI, BCI_trait, q = 1, fdis = FALSE)

# add random character trait
BCI_trait <- cbind(BCI_trait, sample(LETTERS, ncol(BCI), replace = T))

#works
hillR::hill_func(BCI, BCI_trait, q = 1, fdis = FALSE)

There are 2 additional errors that you might want to have a look at:

1) I have to set fdis = FALSE as otherwise the function fails 2) If I provide a distance matrix I have to set traits_as_is = T and checkdata = F otherwise the checks throw an error..

daijiang commented 4 years ago

Can you install the version on Github? I got no error by running your code. Thanks.