optimize this R script:

library(shiny)
library(shinyFiles)
library(MASS)
library(ggplot2)
library(plotly)
library(dplyr)
library(jpeg)
library(grid)
library(cowplot)
library(plyr)
library(reshape2)
library(shinyFiles)
library(data.table)
library(scales)
library(gtable)
library(png)
library(shinythemes)
library(gplots)


options(shiny.maxRequestSize=3000*1024^2) #increase size of allowed data file



# Defining window layout
ad <- readJPEG("./www/logo2.jpg") 
ui <- fluidPage(
      titlePanel(div("AIS Data Visualisation",img(src = "nedcar.png", width = 230, align="right"))),
         column(12,
          column(2,
          
          tags$h4("Top Graph"),
          
          textInput("pathselect1", "Directory:", value = "W:\\paint\\details"),
          selectInput("graphtype", "Type:",
                    c("Panelspershift" = "Panelspershift", "View" = "View","Items" = "Items","Panelsperday" = "Panelsperday", "Totalpershift" = "Totalpershift", "Totalperday" = "Totalperday"), 
                    selected = "Totalperday"),
                          
          numericInput("bodyperday1", "Min Number of bodies per Day", 20, min = 1, NAME_1 = 500, step = 1),
                          
          #numericInput("smooth", "Smooth Factor", 0.2, min = 0.1, NAME_1 = 1, step = 0.1),
                          
          sliderInput("defpbody1", label = "Maximum Defects per Body", min = 0, NAME_1 = 1000, value = c(0, 20)),
                          
          #fileInput("file1", "", accept = c("text/csv",".csv")),
         
      