I made a script to compute a statistical test with R. Everything is ok and I have my result.
Now I'd like to do it with R Shiny. The goal is to import a file with the fileInput
component, then to make the statistical test and finally display it.
I tried to define both the UI part and the server part but this is not working. Indeed I have the following error :
An error has occurred. Check your logs or contact the app author for clarification
Here is my R script :
library("lsr")
library("shiny")
ui <- fluidPage(
titlePanel("title panel"),
fluidRow(
column(3, fileInput("file", h3("File input"))
)
),
fluidRow(
column(width = 3, textOutput("info"))
)
)
server <- function(input, output) {
output$info <- renderText({
mycsv <- read.csv(input$file, header = TRUE, sep = ";")
mycsv <- subset(mycsv, V12=="Nutriment")
df <- as.data.frame(t(mycsv))
colnames(df) <- c("an1", "an2")
df2 <- head (df,-2)
cramer<-cramersV(df2$an1, df2$an2)
res<-data.frame(cramer)
})
}
shinyApp(ui = ui, server = server)
Edit : the dataset used is the one :
0;1;10;2;3;4;5;6;7;8;9;name;year 0;3;0;4;3;0;1;0;4;0;2;Conservatisme;2020
0;0;0;1;2;1;4;2;4;1;1;Humidité;2021
0;0;0;1;2;2;3;2;2;0;0;Nutriment;2020
0;0;0;0;2;3;4;2;2;0;0;Nutriment;2021
0;1;0;2;4;5;2;0;1;1;0;Conservatisme;2021
0;0;0;0;3;3;3;2;3;2;1;Humidité;2020
What is the problem and how could I display the result stored in the res
variable ?
Any help would be very appreciated, thanks.