0

I am trying to make a simple shiny app that takes information from a csv file and produces a table and two graphs. The content appears to be loading correctly but I can not seem to get the output to go within the specified tab, making the output appear cluttered and difficult to read. Any help is appreciated. Thank you in advance

library(ggplot2)
library(plater)
server <- function(input, output) {


output$table1 <- renderTable({

req(input$file1)

df <- read_plate(input$file1$datapath)

if(input$disp == "head") {
  return(head(df))
}
else {
  return(df)
}

data <- reactive({
  read_plate(input$file1$datapath)
})


})



{output$Plot1 <- renderPlot({
req(input$file1)

df <- read_plate(input$file1$datapath)


ggplot(df, aes(x=Column, y=Row, size = 20, color = "variabley")) + geom_point()


})



}

output$vx <- renderUI({
req(input$file1)

df <- read_plate(input$file1$datapath)
selectInput("variablex", "Select the (X) Variable", choices = names(df))
})

output$vy <- renderUI({
req(input$file1)

df <- read_plate(input$file1$datapath)
selectInput("variabley", "Select the (y) Variable", choices = names(df))
})

output$p <- renderPlot({
req(input$file1)

df <- read_plate(input$file1$datapath)
ggplot(df, aes(input$variablex, input$variabley, size = 20)) + geom_point()
  })
  }

ui <- fluidPage(
titlePanel("Enrichment Analysis"),
sidebarLayout(
sidebarPanel(
  fileInput("file1", "Choose CSV File",
            multiple = TRUE,
            accept = c("text/csv",
                       "text/comma-separated-values,text/plain",
                       ".csv")),


  tags$hr(),

  # Input: Checkbox if file has header ----
  checkboxInput("header", "Header", TRUE),

  # Input: Select separator ----
  radioButtons("sep", "Separator",
               choices = c(Comma = ",",
                           Semicolon = ";",
                           Tab = "\t"),
               selected = ","),

  # Input: Select quotes ----
  radioButtons("quote", "Quote",
               choices = c(None = "",
                           "Double Quote" = '"',
                           "Single Quote" = "'"),
               selected = '"'),
  #Checkbox


  # Horizontal line ----
  tags$hr(),

  # Input: Select number of rows to display ----
  radioButtons("disp", "Display",
               choices = c(Head = "head",
                           All = "all"),
               selected = "head")

),






mainPanel(
  tabsetPanel(type = "tab",
              tabPanel("Plot", fluid = TRUE,
                       sidebarLayout(
                         sidebarPanel(selectInput("colm", "Variable", choices = names(df), selected = "")),
                         mainPanel(
                           plotOutput("Plot1")
                         )
                       )
              ),



              tabPanel("Plate"),
                  sidebarPanel(
                   uiOutput("vx"),
                   uiOutput("vy"),
                     mainPanel(plotOutput("p", width = "70%"))
              ),

              tabPanel("Comparison"),
              tabPanel("Table")),




  tableOutput("table1")

)

  )

)

shinyApp(ui, server )
MLavoie
  • 9,671
  • 41
  • 36
  • 56
gcjohn49
  • 1
  • 2
  • We can't run your code. Please provide a reproducible example. – MLavoie Feb 14 '18 at 21:53
  • I'm sorry this is my first post, what is the problem with the input? – gcjohn49 Feb 15 '18 at 01:58
  • We need to load a file (we don't have) to run your code – MLavoie Feb 15 '18 at 02:02
  • The file being uploaded utilizes the plater package in R to convert a 96 well plate (12 columns by rows) into a data frame. I'm not sure if that answers your question but there does not seem to be a way to file share directly – gcjohn49 Feb 15 '18 at 02:21
  • Hi @gcjohn49, please take a look [here](https://stackoverflow.com/questions/48343080/how-to-convert-a-shiny-app-consisting-of-multiple-files-into-an-easily-shareable/48343110#48343110) and [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/), that may help you simplify your question. You can try and remove the reference and use of the plater package, just use for example `mtcars`. If your issue persists; great, your example has become smaller. If your problem disappears; it is probably the plater package and you can specify that in your question. – Florian Feb 15 '18 at 06:28

0 Answers0