2015-02-07 2 views
0

다음과 같은 오류가 발생합니다.나는 빛나는 새로운이며 반복 가능한 간단한 응용 프로그램을 넣으려고합니다.

Listening on http://127.0.0.1:6814 
Error in as.character(x) : 
    cannot coerce type 'closure' to vector of type 'character' 
와 함께 ...

# ui.R ------------- 
library(shiny) 
shinyUI(fluidPage(
    titlePanel("Old Faithful Geyser Data"), 
    sidebarLayout(sidebarPanel(
     rnormA <- repeatable(rnorm), 
     rnormB <- repeatable(rnorm), 
     rnormA(3), # [1] 1.8285879 -0.7468041 -0.4639111 
     rnormA(3), # [1] 1.8285879 -0.7468041 -0.4639111 
     rnormA(5), # [1] 1.8285879 -0.7468041 -0.4639111 -1.6510126 -1.4686924 
     rnormB(5) # [1] -0.7946034 0 
     ), 
     mainPanel() 
) 
)) 

및 ...

# server.R -------------- 
library(shiny) 
shinyServer(function(input, output){repeatable(rngfunc, seed = runif(1, 0, .Machine$integer.max)) 
}) 
+0

당신은 서버에'rngfunc'를 호출하는 것 같다 -

# ui.R ------------- library(shiny) shinyUI(fluidPage( titlePanel("Side Panel"), sidebarLayout(sidebarPanel( h3(textOutput("captionA")), h3(textOutput("captionB")) ), mainPanel(titlePanel("Main Panel"), h3(textOutput("captionAB")) ) ) )) 

가 : 여기에 대한 UI 및 서버 코드 (당신을 위해 세 가지 자막)입니다 코드가 있지만 어디에도 정의되어 있지 않습니다. 그것은 반복 가능한 것으로 전달되어야하는 매개 변수의 이름입니다. 이 코드는 아무 것도 시도하지 않습니다. 여기 목표가 뭐지? – MrFlick

답변

0

나는 이미지는 임의의 값으로 반짝의 간단한 예를 원한다.

# server.R -------------- 
library(shiny) 

shinyServer(
    function(input, output){ 

    output$captionA <- renderText({ 
     repeatable(rngfunc, seed = runif(1, 0, .Machine$integer.max)) 
     rnormA <- repeatable(rnorm) 
     rnormA(3) 
    }) 

    output$captionB <- renderText({ 
     repeatable(rngfunc, seed = runif(1, 0, .Machine$integer.max)) 
     rnormB <- repeatable(rnorm) 
     rnormB(3) 
    }) 

    output$captionAB <- renderText({ 
     repeatable(rngfunc, seed = runif(1, 0, .Machine$integer.max)) 
     rnormA <- repeatable(rnorm) 
     rnormB <- repeatable(rnorm) 
     a<-rnormA(3) 
     b<-rnormB(5) 
     round(c(a,b),2) 
    }) 
    } 
) 

친절 감사,