2014-09-22 61 views
1

這裏是我的閃亮的應用程序的代碼:閃亮的應用 「expr_sub」 缺少錯誤

ui.r

shinyUI(navbarPage("My Application",id="main", 
tabPanel 
(
    "Select Data range", 
    sidebarLayout 
    (
     sidebarPanel 
     (
      selectInput("select_sector", label = h3("Select Sector"),choices = list("Sector 1" = 1, "Sector 2" = 2,"Sector 3" = 3), selected = 1),br(), 
      dateRangeInput("dates_range_input", label = h3("Select Date range")),br(), 
      actionButton("action_proceed1", label = "Proceed to select resolution") 
     ), 
     mainPanel(tableOutput("first")) 
    ) 
), 
tabPanel 
(
    "Select Resolution", 
    sidebarLayout 
    (
     sidebarPanel 
     (
      numericInput("XGRID", label = h3("Select X-Grid Size"), value = 2),br(), 
      numericInput("YGRID", label = h3("Select Y-Grid Size"), value = 2),br(), 
      numericInput("outlier_removal", label = h3("Outlier Removal"), value = 2),br(), 
      numericInput("frequency", label = h3("Frequency"), value = 2),br(), 
      actionButton("action_proceed2", label = "Proceed to Service Parameters") 
     ), 
     mainPanel("Here will be the image for marketing purpose") 
    ) 
) 
)) 

server.r

shinyServer(function(input, output,session) { 
    output$first <- renderTable 
    ({ 
     data.frame(x=1:100,y=1:100) 

    }) 

    observe({ 
    if (input$action_proceed1>0) { 
    updateTabsetPanel(session, "main", selected = "Select Resolution") 
    } 
    }) 
    }) 

我期待輸出定義了數據幀但收到意外錯誤:

argument "expr_sub" is missing, with no default 

請在這裏建議我做錯了什麼。我打算使用輸入變量放置一個數據集,但接收到相同的錯誤,這就是爲什麼爲了簡單起見,我替換了數據框。

+1

你有一個錯字。 '輸出$ first < - renderTable \ n({''應該'輸出$ first < - renderTable({' – jdharrison 2014-09-22 13:26:42

+0

「)非常感謝jdharrison,我花了一個小時在網上搜索,但現在我明白了爲什麼我看不到錯誤複製在網上很多我剛纔刪除了一些空格之前(),它修復了這一點,仍然我看不到/ n在我的文本編輯器(記事本++)你怎麼能看到它? 我寫循環等在R中使用相同的格式總是在循環開始括號之前放置換行符爲什麼在這個閃亮的應用程序失敗? – anonR 2014-09-22 13:36:35

+0

'\ n'只是我表明你有一個換行符,否則我需要作爲回答發佈。輸出$ first'正在分配函數'renderTable',而不是函數使用下面表達式中提供的內容進行評估。 – jdharrison 2014-09-22 13:42:43

回答

1

對其他用戶將argument "expr_sub" is missing, with no default視爲錯誤消息的答案可能很有用。該錯誤表示您在renderTable之後有換行符。當前output$first正在分配函數renderTable,而不是函數使用下面表達式中提供的內容進行評估。

output$first <- renderTable 
({ 
    data.frame(x=1:100,y=1:100) 

}) 

應該是:

output$first <- renderTable({ 
    data.frame(x=1:100,y=1:100) 

}) 

,因爲它代表R的只是解釋代碼在兩個塊的功能output$first隨後的代碼塊的分配。

+0

我的完整應用程序分佈在幾個面板上,但我在這裏只提及其中的兩個。有一個行動,但噸,它應該具有使用瀏覽器打印嚮導打印一個數據幀的功能。我無法通過網絡找到執行此功能的方法。你能建議一個能夠實現上述功能的路徑/包/功能嗎? – anonR 2014-09-22 15:34:16

+0

也許看看'renderDataTable'的開發版本的閃亮支持最新版本的數據表,所以你可以使用插件,支持導出製表數據。 – jdharrison 2014-09-22 15:36:22