【发布时间】:2015-01-15 06:01:28
【问题描述】:
我在尝试运行闪亮的应用程序时收到此错误。
xj[i] 中的错误:无效的下标类型“闭包”
以下是 ui.R 和 server.R 文件。
ui.R
=========
visit = read.csv("lookuptable.csv",head=T) # reading table
shinyUI(pageWithSidebar(
headerPanel('Disease Risk Prediction'),
sidebarPanel(
selectInput("patient",
label = "Patient",
choices = as.character(visit[,1]),
selected = as.character(visit[1,1]),multiple = FALSE)
),
mainPanel(
plotOutput("plot1") # plot bubble chart
)
))
server.R
==========
library(shiny)
shinyServer(
function(input, output) {
visit <- read.csv("lookuptable.csv",head=T)
visit <- visit[1:39,1:22]
ind <- reactive({which(visit[,1]%in%input$patient)})
prob <- reactive({as.numeric(visit[ind,c("prob1","prob2","prob3","prob4","prob5")])})
time <- reactive({as.numeric(visit[ind,c("time1","time2","time3","time4","time5")])})
icd <- reactive({visit[ind,c("icd1","icd2","icd3","icd4","icd5")]})
icd <- reactive({apply(icd,2,as.character)})
# plot bubble chart
output$plot1<- renderPlot(symbols(time(),prob(),circles=prob(),inches=.5,fg="white",bg="red"))
}
)
感谢任何帮助。 提前致谢 石旺
【问题讨论】: