Skip to content

Commit

Permalink
Merge pull request #16 from ajrominger/single_func_fix
Browse files Browse the repository at this point in the history
fixes bug when `traits` argument only has 1 column
  • Loading branch information
daijiang committed Nov 17, 2020
2 parents b170f83 + b2ffa8e commit 3b6c3e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/hill_func.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ hill_func <- function(comm, traits, traits_as_is = FALSE, q = 0, base = exp(1),
if(!inherits(dij, "dist")) stop("`traits` is not a distance object yet `trait_as_is` is TRUE\n")
} else {
# traits is not a distance matrix
traits <- traits[trait_sp, ]
traits <- traits[trait_sp, , drop = FALSE]

if (ncol(traits) == 1) {
# only 1 trait
Expand Down
2 changes: 1 addition & 1 deletion R/hill_func_parti.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ hill_func_parti <- function(comm, traits, traits_as_is = FALSE, q = 0, base = ex
dij <- as.matrix(traits)
} else {
# traits is not a distance matrix
traits <- traits[colnames(comm), ]
traits <- traits[colnames(comm), , drop = FALSE]

if (ncol(traits) == 1) {
# only 1 trait
Expand Down

0 comments on commit 3b6c3e5

Please sign in to comment.