我最近开始学习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)
以下是空白区域的屏幕截图:
更新:
以下是Rstudio中查看器窗格中的内容:
感谢。
答案 0 :(得分:2)
我有同样的问题,请尝试
shinyApp(ui = ui, server = server, options = list(height = 1080))