Guys i am new to Shiny and here i am facing issue with R to shiny translation, i am using SelectInput to give teacher_IDs as input to filter the corresponding students data on sever.r. Data looks like this upto here below code works fine.
library(shiny)
x <- fluidPage("this is fluid page",
selectInput("Selecter","slide to select",choices = ID$Teacher_ID,
selected = "1003935242" ),
tableOutput("data")
################### server.r #################
)
shinyServer(function(input, output)
output$data = renderTable({
TeachersData[TeachersData$Teacher_ID==input$Selecter,]
})
})
But here below when i add more code that actually calculates statistical values using anova,kruskal etc in RenderTable() block like below, i get error message
Error:All observations are in the same group
***, i tried to resolve by doing split and creating groups with factor and few other things but cant resolve. there is no problem in the code, it seems problem manipulation of the data with shiny way.
############ server.r problematic ##########
shinyServer(function(input, output) {
output$data = renderTable({
Instro = TeachersData[TeachersData$Teacher_ID==input$Selecter,]
Data_Procedure1= Instro
Data_Procedure1$Score=as.numeric(as.character(Data_Procedure1$Score))
Data_Procedure1_ByCourse=Subset_Data_ByCourse_fct(Data_Procedure1)
ANOVA_Procedure1= Compare_ANOVA_Procedure1_fct(Data_Procedure1,
Data_Procedure1$Score, as.factor(Data_Procedure1$Course_ID), alpha)
p_Procedure1 = ANOVA_Procedure1$p_value
Method_Procedure1= ANOVA_Procedure1$test_name
PairWise_Compare_Procedure1=Pairwise_Comparison_fct(Method_Procedure1,
Data_Procedure1, Data_Procedure1$Score,
as.factor(Data_Procedure1$Course_ID ))
result <- as.data.frame(PairWise_Compare_Procedure1)
})
})
Please anyone help to figure out, Thank you so much.
Thank you @Ricardo for helping out, but the problem was something else. after further digging out, i found that there is problem with the data set. because when i was filtering the data then some Teacher_ID's in data were having single records and no further sub-grouping, that's was statistical model was unable to capture observations of those Teacher_ID's and throwing error of having all observations in the same group. so when after i filtered out this type data that is not statistically significant everything works fine now.