我正在尝试构建一个闪亮的应用程序,我可以上传一个csv文件,并根据列名称,填充ui左侧列(滑动条列)上的复选框.根据为y轴选择的列和为x轴选择的列,需要能够使用ggplot创建图表.
我的ui.R看起来像这样:
shinyUI(pageWithSidebar(
headerPanel("CSV Viewer"),
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv')),
tags$hr(),
checkboxInput('header', 'Header', TRUE),
radioButtons('sep', 'Separator',
c(Comma=',',
Semicolon=';',
Tab='\t'),
'Comma'),
radioButtons('quote', 'Quote',
c(None='',
'Double Quote'='"',
'Single Quote'="'"),
'Double Quote'),
checkboxGroupInput("variable", "Variable:", choices = names(data_set))
),
mainPanel(
tableOutput('contents')
)
))
Run Code Online (Sandbox Code Playgroud)
Server.R看起来像这样:
shinyServer(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' …
Run Code Online (Sandbox Code Playgroud)