hi, i have two questions,
firstly, is it possible to store a data set within the server?
so this is my UI codes,
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Uploading Files"),
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv', 'text/comma-separated-values,text/plain')),
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'),
br(),
br(),
textInput("data_column","Input the column you wish to check","type something!"),
br(),
br(),
checkboxGroupInput("variables","Choose your column number",c("to be filled up"))
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Contents",tableOutput("contents")),
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table")),
tabPanel("Boxplot",plotOutput("boxplot")),
tabPanel("Logic test",verbatimTextOutput("logic_test"))
)
)
))
while my server codes is
library(shiny)
library(datasets)
shinyServer(function(input, output) {
output$contents <- renderTable({
data_frame<-reactive({
raw_data<-input$file1
if(is.null(raw_data))
return(NULL)
data_frame<-read.csv(raw_data$datapath,header=input$header,sep=input$sep,quote=input$quote)
})
# 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)
})
output$boxplot<-renderPlot({
data_Column<-input$data_column
boxplot(data_frame[,data_Column])
})
})
so basically, what i am essentially trying to do is the user can input name in the textbox, and it returns a boxplot of that box.
but i have no idea how i can preserve the data or to call it within the server once a person has uploaded his file.
i am doing this to deduct outlier using boxplot for non programming users.
Secondly,
is it possible to update the sidebar panel with my names of the data?
so that instead of input the text name in the edit text, when the user uploads a data set, he can just tick the boxes to generate the boxplot individually or against each other.
please help. thank you.