fileInput函数在r中没有响应
我是R和R的新手,一直致力于构建一个统计应用程序,允许用户导入文件,然后对数据运行不同的统计程序。直到最近,fileData函数一直运行良好,现在每当我尝试上载文件时,都不会打开任何内容。我已经尽了我所能让它运行,但似乎该文件不会附加到函数。任何帮助都将不胜感激fileInput函数在r中没有响应,r,shiny,R,Shiny,我是R和R的新手,一直致力于构建一个统计应用程序,允许用户导入文件,然后对数据运行不同的统计程序。直到最近,fileData函数一直运行良好,现在每当我尝试上载文件时,都不会打开任何内容。我已经尽了我所能让它运行,但似乎该文件不会附加到函数。任何帮助都将不胜感激 library(shiny) library(shinyFiles) library(dplyr) library(shinythemes) ui <- fluidPage(theme = shinytheme("cosmo")
library(shiny)
library(shinyFiles)
library(dplyr)
library(shinythemes)
ui <- fluidPage(theme = shinytheme("cosmo"),
# Application title
titlePanel("Stats"),
# Sidebar
sidebarLayout(
sidebarPanel(
tabsetPanel(type = "tab",
tabPanel("SCI",
fileInput("file1", "Insert File", multiple = TRUE, accept = c("text/csv", "text/comma-separated-values, text/plain", ".csv")),
selectInput("statChoice", "Choose Stats", c("None" = "None", "ANOVA 0 w/in 1 btw" = "A1btw", "ANOVA 0 w/in 2 btw" = "A2btw")),
conditionalPanel("statChoice == 'A1btw'",
uiOutput("ind1"),
uiOutput("dep1")),
conditionalPanel("statChoice == 'A2btw'",
uiOutput("ind1"),
uiOutput("ind2"),
uiOutput("dep1")),
)
)
),
# Show a plot of the generated distribution
mainPanel(
tabsetPanel(type = "tab",
tabPanel("Data",
dataTableOutput("fileData")),
tabPanel("Summary Statistics"),
tabPanel("Graphs"))
)
)
)
server <- function(input, output) {
fileData <- eventReactive(input$file1,{
read.csv(input$file1$dataPath, header = TRUE, sep = ",", dec = ".")
})
output$fileData <- renderDataTable(
fileData()
)
vars <- reactive({
names(fileData())
})
output$ind1 <- renderUI({
selectInput("var1", "Independent 1", choices = vars())
})
output$ind2 <- renderUI({
selectInput("var2", "Independent 2", choices = vars())
})
output$dep1 <- renderUI({
selectInput("var3", "Dependent 1", choices = vars())
})
}
shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(shinyFiles)
图书馆(dplyr)
图书馆(shinythemes)
ui很棘手,因为Shinny不会对此给出任何警告:
除了双重使用uiOutput(“dep1”)
和uiOutput(“ind1”)
,一切看起来都正常:
您应该只使用一次输出跟进:
conditionalPanel("statChoice == 'A1btw'",
uiOutput("ind1"), # Used once
uiOutput("dep1")), # Used once
conditionalPanel("statChoice == 'A2btw'",
uiOutput("ind1"), # Used twice
uiOutput("ind2"),
uiOutput("dep1")), # Used twice