私はR光沢のあるアプリを初めて使っています。私のアプリケーションはとてもシンプルです。 2つのタブがあり、最初にCSVなどのファイルをアップロードし、次に2番目のタブでプロットする列を選択します。私のソリューションはいくつかの例に散在していますが、それぞれが私と同じではありません。アップロードされたデータセットは表示され、アップロードするときだけでなく、すべての機能で使用できます。光沢を使ってアップロードしたデータセットをプロットする方法は?
私server.R
library(shiny)
shinyServer(function(input, output) {
output$contents <- renderTable({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
read.csv(inFile$datapath, header=input$header, sep=input$sep,
quote=input$quote)
})
output$MyPlot <- renderPlot({
x <- contents()$contents[, c(input$xcol, input$ycol)]
bins <- nrow(contents())
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
ui.R
library(shiny)
library(datasets)
shinyUI(fluidPage(
titlePanel("Column Plot"),
tabsetPanel(
tabPanel("Upload File",
titlePanel("Uploading Files"),
sidebarLayout(
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv',
'text/comma-separated-values,text/plain',
'.csv'))
),
mainPanel(
tableOutput('contents')
)
)
),
tabPanel("First Type",
pageWithSidebar(
headerPanel('My First Plot'),
sidebarPanel(
selectInput('xcol', 'X Variable', names(content)),
selectInput('ycol', 'Y Variable', names(content),
selected=names(content)[[2]])
),
mainPanel(
plotOutput('MyPlot')
)
)
)
)
)
)
私はそれを試してみたが、私はちょうどので、私は何をしてくださいやるべきことを始めていますか?
助けを得るために、光沢のあるアプリで使用する.csvファイルを提供することをお勧めします。 – aelwan