我试图获得一个闪亮的输入文件,并在以后使用它进行一些计算。我正在尝试使用reactive.But将输入文件分配给数据帧总是得到相同的错误 “.getReactiveEnvironment()中的错误$ currentContext:没有活动的反应上下文时不允许操作。(您尝试做的事情只能在反应式表达式或观察者内部完成。) 堆栈跟踪(最里面的第一个):“
server.R
library(shiny)
library(radarchart)
library(fmsb)
library(corrplot)
options(shiny.maxRequestSize = 9*1024^2)
function(input, output) {
output$contents <- renderTable({
# input$file1 will be NULL initially. After the user selects
# and uploads a file, it will be a data frame with 'name',
# 'size', 'type', and 'datapath' columns. The 'datapath'
# column will contain the local filenames where the data can
# be found.
inFile <- input$file1
if (is.null(inFile))
return(NULL)
read.csv(inFile$datapath, header = input$header,
sep = input$sep, quote = input$quote)
})
candidate <- input$file1
ui.R
# Define UI for random distribution application
shinyUI(pageWithSidebar(
headerPanel('Competency Profiling Tool for Software Engineers'),
sidebarPanel(
fileInput('file1', 'Choose file to upload',
accept = c(
'text/csv',
'text/comma-separated-values',
'.csv')
),
tags$hr(),
checkboxInput('header', 'Header', TRUE),
tags$hr() ,
selectInput("dataset", "Choose level of Competence Analysis :", choices = c("Level 2", "Level 3"), selected = "Level 2"),
radioButtons("selectedCategory","Choose Competency category : ", rownames(x), selected = "Professional skills" ),
checkboxGroupInput('selectedLevels', 'Choose Job profile', names(scores[]), selected="Technical Junior"),
sliderInput("Candidate", "Choose candidate :", min = 1, max = 50, value = 1),
radioButtons( "method", "Choose Clustering method : ", choices = list("ward.D"=1,"ward.D2"=2,"Single"=3,"Complete"= 4,"Average"=5,
"mcquitty"=6,"median"=7,"centroid"=8),
selected = 4) ),
mainPanel( div(tabsetPanel(type="tabs",
tabPanel("Level2/Level3 RCD frame", tableOutput("table")),
tabPanel("Candidates ACD frame", tableOutput("contents")),
tabPanel("Radar Plot of RCD frame" ,plotOutput("triangle", width = "80%", height = "700px"), width = 12 ),
tabPanel("SimpleGap & AbsoluteGap of Selected Candidate", br(),
style="color:black",h1("Simple Gap SOQ-Space SUQ-Space Absolute Gap"),
column(width=1,offset=0,tableOutput("sgap")),
column(width=1,offset=1,tableOutput("soq")),
column(width=1,offset=1,tableOutput("suq")),
column(width=1,offset=1,tableOutput("absgap")) ),
tabPanel("RCD + ACD Plots",chartJSRadarOutput("radar",width = "900%", height = "300%" ) ,
chartJSRadarOutput("radar2",width = "900%", height = "300%" ) ) ,
tabPanel("Clustering Plot #1",plotOutput("cluster", width = "100%", height = "900px"), width = 7 ),
tabPanel("Clustering Plot #2",plotOutput("cluster2",width = "100%", height = "900px"),width = 7),
tabPanel("Correlation Plots",plotOutput("corellation",width = "100%", height = "900px"),width = 7 )),
class = "span8")
)
)
)