I'm new to this forum so please do forgive my mistakes; I'm trying to code a shiny proteomic interface. for that I was stuck one way in making multiple plots and an other in making them reactive; furthermore when I try to load multiple files it works in one tab and in the next tab it only shows me one and when I reupload another file even if the original tab gets updated but the second doesn't it stays in the first plot. here is a portion of the code:
library(shiny)
shinyServer(function(input, output, session) {
library(MALDIquantForeign)
library(MALDIquant)
##ENTREE
infile_p<-reactive({
f<-input$p_file
fd<-f$datapath
for(i in 1:length(f))
{
file.rename(fd[i],f$name[i])
}
paste(f$name)
})
##VARIABLE INTERMEDIAIRE
p<-reactiveValues(data = NULL)
##PRE-PROCESS
observeEvent(input$Process ,{
l<-import(infile_p(), type="auto")
for (i in 1:length(l)) {
local({
my_i <- i
plotname <- paste("bPlot", my_i, sep="")
output[[plotname]] <- renderPlot({
plot(l[[my_i]], width="700", height="450")
})
})
}
p$data<-list("before"=l)
})
##SORTIE
output$bPre <- renderUI({
l<-p$data$before
plot_output_list <- lapply(1:length(l), function(i) {
plotname <- paste("bPlot", i, sep="")
plotOutput(plotname)
})
do.call(tagList, plot_output_list)
})
output$vStabl<- renderUI({
l<-p$data$before
vplot_output_list <- lapply(1:length(l), function(i) {
vplotname <- paste("vPlot", i, sep="")
plotOutput(vplotname)
})
do.call(tagList, vplot_output_list)
})
})
observe({
if(is.null(p$data$before)) return()
invalidateLater(5000, session)
ll<-reactiveValues(
data=transformIntensity(p$data$before,method="sqrt")
)
for (i in 1:length(v)) {
local({
my_i <- i
vplotname <- paste("vPlot", my_i, sep="")
output[[vplotname]] <- renderPlot({
plot(ll$data[[my_i]], width="700", height="450")
dev.off()
})
})
}
})
})
And the ui containes two uioutputs; please do help me i really want to learn this.