inst/app-inferr/logic/logic_binomtest.R

observe({
    updateSelectInput(session,
                      inputId = "var_binomtest",
                      choices = names(data()),
                      selected = '')

})

observeEvent(input$finalok, {
    f_data <- final_split$train[, sapply(final_split$train, is.factor)]
    if (is.null(dim(f_data))) {
        k <- final_split$train %>% map(is.factor) %>% unlist()
        j <- names(which(k == TRUE))
        fdata <- tibble::as_data_frame(f_data)
        colnames(fdata) <- j
        updateSelectInput(session, inputId = "var_binomtest",
            choices = names(fdata))
        } else {
          updateSelectInput(session, 'var_binomtest', choices = names(f_data))
        }
})

observeEvent(input$submit_part_train_per, {
    f_data <- final_split$train[, sapply(final_split$train, is.factor)]
    if (is.null(dim(f_data))) {
        k <- final_split$train %>% map(is.factor) %>% unlist()
        j <- names(which(k == TRUE))
        fdata <- tibble::as_data_frame(f_data)
        colnames(fdata) <- j
        updateSelectInput(session, inputId = "var_binomtest",
            choices = names(fdata))
        } else {
          updateSelectInput(session, 'var_binomtest', choices = names(f_data))
        }
})

d_binomtest <- eventReactive(input$submit_binomtest, {
	# validate(need((input$var_binomtest != ''), 'Please select two variables.'))
  req(input$var_binomtest)
  data <- final_split$train[, c(input$var_binomtest)]
})

output$binomtest_out <- renderPrint({
  # validate(need(nlevels(d_binomtest()) == 2, 'Please select a binary variable.'))
  infer_binom_test(final_split$train, !! sym(as.character(input$var_binomtest)),
                   input$binomtest_prob)
})

output$binomcalc_out <- renderPrint({
  infer_binom_calc(input$n_binomcalc, input$s_binomcalc, input$p_binomcalc)
})

Try the xplorerr package in your browser

Any scripts or data that you put into this service are public.

xplorerr documentation built on Feb. 28, 2019, 5:05 p.m.