Skip to content

Commit

Permalink
Adding 'pause' option for correlation and linear regression
Browse files Browse the repository at this point in the history
  • Loading branch information
vnijs committed Feb 10, 2016
1 parent d7ab82c commit f0f0ad1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions R/correlation.R
Expand Up @@ -32,8 +32,6 @@ correlation <- function(dataset, vars,
dat <- getdata(dataset, vars, filt = data_filter) %>%
mutate_each(funs(as.numeric))

method

if (!is_string(dataset)) dataset <- "-----"

## using correlation_ to avoid print method conflict with nlme
Expand Down
10 changes: 5 additions & 5 deletions inst/base/global.R
Expand Up @@ -79,11 +79,11 @@ addResourcePath("js", file.path(r_path,"base/www/js/"))

## ensure that MathJax is only used if loaded to avoid breaking conditional panels
## https://github.com/rstudio/shiny/issues/692
withMathJax <- function (...) {
path <- "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
tagList(tags$head(singleton(tags$script(src = path, type = "text/javascript"))),
..., tags$script(HTML("if (window.MathJax) MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);")))
}
# withMathJax <- function (...) {
# path <- "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
# tagList(tags$head(singleton(tags$script(src = path, type = "text/javascript"))),
# ..., tags$script(HTML("if (window.MathJax) MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);")))
# }

nav_ui <-
list(windowTitle = "Radiant", id = "nav_radiant", inverse = TRUE,
Expand Down
4 changes: 3 additions & 1 deletion inst/quant/tools/analysis/correlation_ui.R
Expand Up @@ -39,6 +39,7 @@ output$ui_cor_vars <- renderUI({
output$ui_correlation <- renderUI({
list(
wellPanel(
checkboxInput("cor_pause", "Pause estimation", state_init("cor_pause", FALSE)),
uiOutput("ui_cor_vars"),
selectInput(inputId = "cor_type", label = "Method:", choices = cor_type,
selected = state_single("cor_type", cor_type, "pearson"), multiple = FALSE),
Expand Down Expand Up @@ -91,15 +92,16 @@ output$correlation <- renderUI({
})

cor_available <- reactive({

if (not_available(input$cor_vars) || length(input$cor_vars) < 2)
return("This analysis requires two or more variables or type numeric, integer,\nor factor. If these variable types are not available please select\nanother dataset.\n\n" %>% suggest_data("diamonds"))

req(input$cor_pause == FALSE)
"available"
})


.correlation <- reactive({
req(input$cor_pause == FALSE)
do.call(correlation, cor_inputs())
})

Expand Down
2 changes: 2 additions & 0 deletions inst/quant/tools/analysis/regression_ui.R
Expand Up @@ -279,6 +279,7 @@ output$ui_regression <- renderUI({
)
),
wellPanel(
checkboxInput("reg_pause", "Pause estimation", state_init("reg_pause", FALSE)),
uiOutput("ui_reg_rvar"),
uiOutput("ui_reg_evar"),

Expand Down Expand Up @@ -394,6 +395,7 @@ reg_available <- reactive({
})

.regression <- reactive({
req(input$reg_pause == FALSE)
do.call(regression, reg_inputs())
})

Expand Down

0 comments on commit f0f0ad1

Please sign in to comment.