Commit a7db4a9a authored by Midoux Cedric's avatar Midoux Cedric
Browse files

MANOVA interactions

parent 58726f00
......@@ -151,22 +151,50 @@ output$betaManovaUI <- renderUI({
title = "Setting : " ,
width = NULL,
status = "primary",
selectInput("betaManovaVar",
label = "Covariates",
multiple = TRUE,
choices = c(sample_variables(physeq())),
selected = NULL)#,
selectizeInput("betaManovaVar",
label = "Covariates (ordered list ; max=3) :",
multiple = TRUE,
choices = c(sample_variables(physeq())),
selected = NULL,
options = list(maxItems = 3)
),
checkboxGroupInput("betaManovaInteraction",
label = "Add interaction :",
choices = NULL,
inline = TRUE)#,
# actionButton("betaManovaButton",
# "Compute"),
)
})
observe({
if (is.null(input$betaManovaVar)) {
interactions <- NULL
} else {
interactions <- list(NULL,
paste(input$betaManovaVar, collapse = ":"),
c(paste(input$betaManovaVar[c(1, 2)], collapse = ":"),
paste(input$betaManovaVar[c(1, 3)], collapse = ":"),
paste(input$betaManovaVar[c(2, 3)], collapse = ":"),
paste(input$betaManovaVar, collapse = ":"))
)[[length(input$betaManovaVar)]]
}
updateCheckboxGroupInput(session,
inputId = "betaManovaInteraction",
choices = interactions,
inline = TRUE
)
})
formula <- reactive({as.formula(paste("betaDist()", "~", paste(c(input$betaManovaVar, input$betaManovaInteraction), collapse = "+")))})
output$betaManova <- renderPrint({
validate(need(physeq(), "Requires an abundance dataset"))
validate(need(input$betaManovaVar, "Requires at least one covariate"))
vegan::adonis(
as.formula(paste("betaDist()", "~", paste(input$betaManovaVar, collapse = "*"))),
formula = formula(),
data = as(sample_data(physeq()), "data.frame"),
perm = 9999)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment