【发布时间】:2016-11-03 08:32:35
【问题描述】:
我最近开始学习 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 的查看器窗格中看到的样子:
谢谢。
【问题讨论】:
-
它在 Rstudio 中的外观如何?
-
我更新了一张 Rstudio 截图。