Skip to content

Commit

Permalink
Merge pull request #16 from PennChopMicrobiomeProgram/update-for-vega…
Browse files Browse the repository at this point in the history
…n2.6-8

Update for vegan2.6-8
  • Loading branch information
kylebittinger authored Nov 23, 2024
2 parents 7c6a53c + b7669bd commit 85f16fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/adonis-custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ adonisplus <- function(data, distmat, formula, sample_id_var = SampleID,

set.seed(seed)
a_observed <- vegan::adonis2(
formula = formula, data = data, permutations = permutations
formula = formula, data = data, permutations = permutations, by = "terms"
)
result <- tidy.anova.cca(a_observed)

Expand Down Expand Up @@ -81,7 +81,9 @@ adonisplus <- function(data, distmat, formula, sample_id_var = SampleID,
new_vals <- fcn(old_vals, rep_meas_vals)
trial_data[[var]] <- new_vals
}
trial_a <- vegan::adonis2(formula, trial_data, permutations = 4)
trial_a <- vegan::adonis2(
formula, trial_data, permutations = 4, by = "terms"
)
trial_result <- tidy.anova.cca(trial_a)
trial_result$statistic[term_idx]
})
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-adonis-custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ test_that("adonisplus works for one group with restricted permutations", {
statistic = c(0.863281711244329, NA, NA),
p.value = c(0.8, NA, NA)
)
if (Sys.info()["sysname"] == "Darwin") {
expected$p.value <- c(0.9, NA, NA)
}
expect_equal(observed, expected)
})

Expand Down

0 comments on commit 85f16fb

Please sign in to comment.