重新计算情节时闪亮的崩溃

时间:2015-04-05 19:52:01

标签: r shiny shiny-server

我正在尝试使用闪亮的反应输出图,但每次我尝试移动幻灯片时整个应用程序崩溃,并且在控制台中我得到[...截断]消息。这是UI的代码:

    shinyUI(fluidPage(

  fluidRow(
    column(
    width=8, offset=2,
    h1("Palabras reguladoras en secuencias no   codificantes",align="center",style="padding-top:15px;font-size:28px")
)),

 fluidRow(
 column(
    width=12,
    h3(strong("Represión de UTR´s en ratón con microRNA"),
      align="center",style="font-size:20px;line-height:10px")
    )
),

 wellPanel(align = "center", sliderInput("largo", label = h3("Número de     bases en la palabra"), min = 1, max = 10, value = 6)),

wellPanel(align = "center", plotOutput("grafica"), tableOutput      ("tabla"))

))

以及服务器的代码:

shinyServer(function(input, output){

 observe({

 rm(list=ls())

largo = input$largo

all_arr = colSums(oligonucleotideFrequency(allutrs, width = largo, step     = 1))
rep_arr = colSums(oligonucleotideFrequency(represedutrs, width = largo,     step = 1))

vector_n = sum(all_arr) - all_arr 

tabla = data.frame(rep_arr, all_arr, vector_n, sum(rep_arr))

 names(tabla) = c("x", "m", "n", "k")

tabla$hyper = phyper(q = tabla[,1], m = tabla[,2], n = tabla[,3], k =       tabla[,4], lower.tail = FALSE)

 tabla$hyper_log = -log10(vector)

 cuantil = quantile(tabla$hyper_log, probs = 0.99)

 tabla$arriba = tabla$hyper_log >= cuantil

centradi = c()
nombres = c()
ia = 0
i = 0
for (i in 1:length(tabla$hyper_log)){
    if (tabla[i, "arriba"] == T){
    ia = ia + 1
    centradi[ia] = tabla$hyper_log[i]
    nombres[ia] = row.names(tabla[i,])
    }
 }

 names(centradi) = nombres

 #valor_y_graf = tabla[names(centradi),6]
 #valor_x_graf = which(tabla$arriba == T)

#partes = list(
#function() plot(tabla$hyper_log, main = "Densidad", xlab =         "Palabras", ylab = "Distribución hipergemetrica (-log(10))"),
    #function() abline(cuantil,0, col = "red"),
    #function() text(valor_x_graf, valor_y_graf, names(centradi),   cex=0.6,pos=4, col="blue"))

#output$grafica = renderPlot(for (i in 1:3) partes[[i]]())
output$grafica = renderPlot(plot(tabla$hyper_log))
output$tabla = renderTable(head(tabla))
  })

})

我认为这是因为高内存使用,特别是在for循环中,因为当它拿走它运行时。有没有办法使这项工作?

0 个答案:

没有答案