【发布时间】:2017-03-07 15:01:54
【问题描述】:
在我闪亮的应用程序的 server.R 上,我基本上有这个: 图书馆 fmsb, 一个数据集和一个雷达图, 我可以在 R studio 的绘图查看器中查看图表,但是如何在 UI.R 中显示图表的显示? 感谢您的所有帮助。
library(fmsb)
# Create data: note in High school for several students
set.seed(99)
data=as.data.frame(matrix( sample( 0:20 , 15 , replace=F) , ncol=5))
colnames(data)=c("math" , "english" , "biology" , "music" , "R-coding" )
rownames(data)=paste("mister" , letters[1:3] , sep="-")
# To use the fmsb package, I have to add 2 lines to the dataframe: the max and min of each topic to show on the plot!
data=rbind(rep(20,5) , rep(0,5) , data)
colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) , rgb(0.7,0.5,0.1,0.9) )
colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) , rgb(0.7,0.5,0.1,0.4) )
radarchart( data , axistype=1 ,
#custom polygon
pcol=colors_border , pfcol=colors_in , plwd=4 , plty=1,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,20,5), cglwd=0.8,
#custom labels
vlcex=0.8
)
legend(x=0.7, y=1, legend = rownames(data[-c(1,2),]), bty = "n", pch=20 , col=colors_in , text.col = "grey", cex=1.2, pt.cex=3)
我是 R 和 Shiny 的新手,所以我不确定在最终框中使用什么:
library(shiny)
library(shinydashboard)
library(fmsb)
#for the geoschool selection screen
df_geo_13_14 <- data.frame(geometry.annual.report.december.2014.may.2015.clean)
geo_school <- df_geo_13_14$School.Name
geo_list <- as.list(geo_school)
#end selection screen
dashboardPage(
dashboardHeader(title = "Working on it"),
dashboardSidebar(),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(
selectInput("School","Please select the schools you want to compare",
choices = c("Elementary", "Middle & High"))),
box(
title = "Controls",
sliderInput("schoolSize", "Please filter the schools based upon student population:",
min=2, max = 800, value = c(100, 200), step = 20)
)
),
fluidRow(
box(
selectizeInput("geo_13_14", "Select the school, sos my wording:", choices = geo_school )
),
box(
??????????How do I display the radar chart?????????
)
)
)
)
【问题讨论】:
标签: r shiny rstudio shiny-server