我尝试根据操作按钮读取数据,但我无法访问其他表达式中的数据。我尝试了不同的方法,但都没有用。
S.Data <- observeEvent(input$RawGo,{
read.maimages(files = targets$FileName, source = input$imageS,
path = "Raw data/", green.only = T)
})
另一种方式:
observeEvent(input$RawGo,{
S.Data <- read.maimages(files = targets$FileName, source = input$imageS,
path = "Raw data/", green.only = T)
})
另一种方式:
observeEvent(input$RawGo,{
S.Data <- reactive({read.maimages(files = targets$FileName, source = input$imageS,
path = "Raw data/", green.only = T)
})
})
没有任何效果。
完整代码
output$RawButton <- renderUI({
if(!is.null(input$File1)){
if(input$imageS != "Other"){
actionButton(inputId = "RawGo", label = "Read data", icon = icon("upload"))
} else{
actionButton(inputId = "RawGo", label = "Read data, if import is correctly", icon = icon("upload"))
}
}
})
S.Data <- reactive({input$RawGo;isolate({
targets = readTargets(input$File1$datapath, sep=input$sep)
if(input$imageS != "Other" & input$datatype == "One"){
read.maimages(files = targets$FileName, source = input$imageS,
path = "Raw data/", green.only = T)
}else if(input$imageS != "Other" & input$datatype == "Two"){
read.maimages(files = targets$FileName, source = input$imageS,
path = "Raw data/")
}else if(input$imageS == "Other" & input$datatype == "One" & input$RawCBack == "Y"){
read.maimages(files = targets$FileName,
path = "Raw data/",
columns=list(G=input$RawProbe, Gb=input$RawBack),
green.only = T)
}else if(input$imageS == "Other" & input$datatype == "One" & input$RawCBack == "N"){
read.maimages(files = targets$FileName,
path = "Raw data/",
columns=list(G=input$RawProbe),
green.only = T)
}else if(input$imageS == "Other" & input$datatype == "Two" & input$RawCBack == "Y"){
read.maimages(files = targets$FileName,
path = "Raw data/",
columns=list(G=input$RawProbe, Gb=input$RawBack, R=input$RawProbeR,Rb=input$RawBackR))
}else if(input$imageS == "Other" & input$datatype == "Two" & input$RawCBack == "N"){
read.maimages(files = targets$FileName,
path = "Raw data/",
columns=list(G=input$RawProbe, R=input$RawProbeR))
}
})
})
#--------------------------------Preprocessing---------------------------
output$PrePMis<- renderUI({
D.Data <- S.Data()
})
})
输出$ PrePMis在另一个标签中。当我使用输出$ PrePMis
转到选项卡时,代码独立于按钮并执行