【发布时间】:2015-08-22 23:59:19
【问题描述】:
这是我正在尝试做的第一个闪亮的应用程序。
之前我查看了一些教程,当我在外部运行应用程序时,所有这些都显示在网络浏览器中。
现在所有内容都显示在 webbrowser 中,但在 R studio 的查看器中显示了一个绘图。它对在网络浏览器中正确显示的滑块输入有反应。我显然希望它在网络浏览器中显示所有内容
可能是什么问题?我用钻石数据集做了可重复的例子 代码如下:
ui.R
library(shiny)
library(ggvis)
library(ggplot2)
library(dplyr)
shinyUI(fluidPage(
titlePanel("Analyza demografickych udajov Slovenskej republiky"),
sidebarLayout(
sidebarPanel(
sliderInput("rok","Vyber rok ktory chces pozriet",min = min(diamonds$table),max = max(diamonds$table),value = 60,step = 1)
),
mainPanel(
tabsetPanel(type="tab",
tabPanel("plot",plotOutput("plot")),
tabPanel("Vzorka raw dat",tableOutput("table"))
)
)
)))
server.R
library(shiny)
library(ggvis)
library(ggplot2)
library(dplyr)
#read.csv("Demog.csv")
#p<-read.table(file = "Demog.csv",header = T,sep = ";")
#head(p)
#colnames(p)[2]<-"rok"
#colnames(p)[3]<-"pocet obyvatelov"
shinyServer(function(input,output){
output$table<-renderTable({
head(diamonds,10)
})
output$plot<-renderPlot({
diamonds%>%filter(table==as.numeric(input$rok))%>%ggvis(~depth,~price)%>%layer_lines
})
})
}
【问题讨论】:
-
尝试在
renderPlot末尾添加print(p)
标签: r data-visualization shiny