Skip to content

Instantly share code, notes, and snippets.

@SachaEpskamp
Created June 2, 2018 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SachaEpskamp/47ae156abb95e63a8803c073977d2c1f to your computer and use it in GitHub Desktop.
Save SachaEpskamp/47ae156abb95e63a8803c073977d2c1f to your computer and use it in GitHub Desktop.
Statcheck web app
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(statcheck)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
img(src = "http://statcheck.io/statcheck.png", width = 350),
br(),
mainPanel(
div(style="display:inline-block",textInput("stat", "Statistic", value = "F(2, 100) = 3.01, p < 0.05")),
div(style="display:inline-block",submitButton("Check!")),
br(),
textOutput("resultString")
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
Stat <- reactive({
if(is.null(input$stat)) {
return(NA)
} else{
return(input$stat)
}
})
output$resultString <- renderText({
if (is.na(Stat())){
return("")
}
Result <- statcheck(Stat(),OneTailedTests = FALSE,pEqualAlphaSig = FALSE,OneTailedTxt = FALSE)[1,]
if (Result$Error){
# Res <- paste0(Result$Statistic,"(",Result$df1,", ",Result$df2,"), = ",Result$Value,", p ",ifelse(Result$Computed < 0.05,"<",">")," 0.05\n\n","Checked statistic is WRONG! ")
Res <- "Checked statistic is WRONG!"
} else {
# Res <- paste0(Result$Statistic,"(",Result$df1,", ",Result$df2,"), = ",Result$Value,", p ",ifelse(Result$Computed < 0.05,"<",">")," 0.05\n\n","Checked statistic is correct! ")
Res <- "Checked statistic is correct!"
}
return(Res)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment