빛나는 UI 안에 llply 진행률 표시 줄을 표시하는 방법을 찾고 싶습니다. 코드를 살펴보십시오. 너는 어떤 생각을 가지고 있니?반짝 이는 진행률 표시 줄과 llply 진행률 표시 줄을 동기화하는 방법
library(shiny)
library(plyr)
function_I_cant_edit <- function(){plyr::llply(LETTERS ,.fun=function(x){Sys.sleep(0.2)},.progress = "text")}
server<-shinyServer(function(input, output,session) {
observeEvent(input$go, {
progress <- shiny::Progress$new(session, min=1, max=15)
on.exit(progress$close())
progress$set(message = 'Calculation in progress')
function_I_cant_edit()
for (i in 1:15) {
progress$set(value = i)
Sys.sleep(0.1)
}
})
output$plot <- renderPlot({
plot(cars)
})
})
ui <- basicPage(
actionButton("go","PUSH ME"),
plotOutput("plot")
)
shinyApp(ui = ui, server = server)
아이디어는 llply 내부 진행 = "TK"를 사용하는 것입니다,하지만 섹시한 방법은 무엇입니까?
또 다른 아이디어는 반짝이는 응용 프로그램에서 콘솔 출력을 보여줄 것입니다 ... 그러나 나는 이것을 관리하지 않았습니다.
감사
편집 :
llpy 기능을 사용 progress_tk() 또는 progress_text() 또는 progress_time()
그래서 나는 progress_shiny() 함수를 생성progress_shiny <-function (title = "plyr progress", label = "Working...", ...)
{
n <- 0
tk <- NULL
list(init = function(x) {
tk <<- shiny::Progress$new(session,min=1, max=15)
tk$set(message = 'Calculation in progress')
}, step = function() {
n <<- n + 1
tk$set(value = n)
}, term = function() print("fin"))
}
그리고 나는 시도했다 :
server<-shinyServer(function(input, output,session) {
# session <<- session
observeEvent(input$go, {
# function_I_cant_edit()
llply(LETTERS ,.fun=function(x){Sys.sleep(0.2)},.progress = "shiny")
})
output$plot <- renderPlot({
plot(cars)
})
})
ui <- basicPage(
actionButton("go","PUSH ME"),
plotOutput("plot")
)
shinyApp(ui = ui, server = server)
,210
그러나 오류 메시지가 'public_bind_env의 $의 초기화 (...) 오류 : 오브제'는 ... 세션 'introuvable'
내가가는 길에 메신저 뭔가 찾을 생각)
plyr''에서 진행 표시 줄이 그냥 capture.output''로 캡처 할 수 콘솔에 인쇄 된 텍스트 되나 나는'plyr'에서 진한 UI로 진행 바를 얻을 수있을 것이라고 생각하지 않습니다. – Carl
퍽스, 알아,하지만 capture.output은 실시간으로되지 않을거야 .. –