2016-07-01 61 views
1

我最近開始學習Shiny,並正在開發我的第一個練習應用程序。出於某種原因,我的應用程序不佔用整個瀏覽器窗口,但大約中途截止。該頁面仍然可以向下滾動以查看其餘的輸出,但出於某種原因存在高摺疊。下面是我的代碼:閃亮的應用程序只是瀏覽器窗口的一半

library(foreign) 
library(dplyr) 
library(shiny) 
library(dplyr) 
library(ggplot2) 
library(shinythemes) 

thesis <- read.csv("thesis.csv", stringsAsFactors = T) 

ui <- fluidPage(theme = shinytheme("cerulean"), 

    # Application title 
    titlePanel("Annual Prices by City"), 

    # Sidebar with choice selected 
    sidebarLayout(
    sidebarPanel(
     selectInput("city","City",as.character(thesis$city)), 
     tableOutput("table") 
    ), 

    # Show a time series line plot 
    mainPanel(
     textOutput("cityheader"), 
     plotOutput("plot", width="100%") 

    ) 
) 
) 


server <- function(input, output, session) { 
    df <- reactive({ 
    thesis %>% 
     select(city, year, price) %>% 
     filter(city == input$city) 

    }) 

    output$plot <- renderPlot({ 
    ggplot(df(), aes(x=year, y=price)) + 
     labs(title=input$city, x="Year", y="Annual Avg Price") + 
     geom_line(col="blue") 

    }, height=400, width = 700) 

    output$table <- renderTable({ 
    df() 

    }) 

    output$cityheader <- renderText({ 
    input$city 
    }) 

} 

shinyApp(ui=ui,server=server) 

這裏是空白的截圖:

Screenshot of the Shiny App

UPDATE:

這裏是什麼樣子從觀衆在Rstudio窗格中:

Rstudio Screenshot

謝謝。

+0

如何看待中Rstudio? – zacdav

+0

我更新了Rstudio截圖。 – Easthaven

回答

1

我有同樣的問題,請嘗試

shinyApp(ui = ui, server = server, options = list(height = 1080)) 
+0

修復它。謝謝! – Easthaven

相關問題