title: Why am I getting Error: could not find function multiplot in Rshiny app?
body: <p>I am trying to make a tab of my R shiny app display multiple plots using the ggplot2 multiplot() function. All the other libraries I use are in my global.R, but the ggplot2 library is definitely imported, so I don't understand why I get this error:</p>
  
  <p>ERROR: could not find function multiplot.</p>
  
  <p>in the multiplot tab.</p>
  
  <p>Right now I am just trying to even call the multiplot() function, so I am just plotting the same graph two times (multiplot(p,p)).</p>
  
  <p>Here are the relevant parts of my code:</p>
  
  <p>ui.R</p>
  
  <pre><code>dataset &lt;- list('Upload a file'=c(1))
  
  shinyUI(pageWithSidebar(
  
    sidebarPanel(
  
      fileInput('file', 'Data file'),
      radioButtons('format', 'Format', c('CSV', 'TSV')),
  
  
  
        conditionalPanel(condition = "input.tsp == 'sort'",
                         checkboxInput(inputId = "pageable", label = "Make table pageable"),
                         conditionalPanel("input.pageable==true",
                                          numericInput(inputId = "pagesize",
                                                       label = "Entries per page",10))              
  
  
        ),
        conditionalPanel(condition = "input.tsp == 'multi' ",
  
  
            selectInput('x', 'X', names(dataset)),
            selectInput('y', 'Y', names(dataset),  multiple=T),
            selectInput('color', 'Color', c('None', names(dataset))),
  
            checkboxInput('jitter', 'Jitter'),
            checkboxInput('smooth', 'Smooth'),
  
            selectInput('facet_row', 'Facet Row', c(None='.', names(dataset))),
            selectInput('facet_col', 'Facet Column', c(None='.', names(dataset)))
  
        )
  
    ),
  
    mainPanel( 
        tabsetPanel(
          tabPanel("Sortable Table", htmlOutput("gvisTable"),value="sort"),
          tabPanel("Multiplot", plotOutput('plotMulti'), value="multi"),
          id="tsp"            #id of tab
        )
  
    )
  )
  </code></pre>
  
  <p>This is my server.R:</p>
  
  <pre><code>library(reshape2)
  library(googleVis)
  library(ggplot2)
  
  shinyServer(function(input, output, session) {
  
    #-----------------------------------------------------------
    # Dataview Tab Inputs
    #-----------------------------------------------------------  
  
    data &lt;- reactive({
  
      if (is.null(input$file))
        return(NULL)
      else if (identical(input$format, 'CSV'))
        return(read.csv(input$file$datapath))
      else
        return(read.delim(input$file$datapath))
    })
  
    observe({
      df &lt;- data()
      str(names(df))
      if (!is.null(df)) {
        updateSelectInput(session, 'x', choices = names(df))
        updateSelectInput(session, 'y', choices = names(df))
        updateSelectInput(session, 'color', choices = c('None', names(df)))
        updateSelectInput(session, 'facet_row', choices = c(None='.', names(df)))
        updateSelectInput(session, 'facet_col', choices = c(None='.', names(df)))
  
      }
    })
  
  
    myOptions &lt;- reactive({
      list(
  
        page=ifelse(input$pageable==TRUE,'enable','disable'),
        pageSize=input$pagesize,
        width=1000
  
        )
    })
  
    output$gvisTable &lt;- renderGvis( {
      if (is.null(data()))
        return(NULL)
  
      gvisTable(data(), options=myOptions())
  
  
    })
  
    #-----------------------------------------------------------
    # Graphs
    #-----------------------------------------------------------  
  
  
    output$plotMulti &lt;- renderPlot({
      if (is.null(data()))
        return(NULL)
  
      temp &lt;- input$x
      p &lt;- ggplot(data(), aes_string(x=temp, y=input$y), environment = environment()) 
      p &lt;- p + geom_bar()
  
      if (input$smooth)
        p &lt;- p + geom_smooth()
  
      if (input$color != 'None')
        p &lt;- p + aes_string(color=input$color)
  
      facets &lt;- paste(input$facet_row, '~', input$facet_col)
      if (facets != '. ~ .')
        p &lt;- p + facet_grid(facets)
  
      if (input$jitter)
        p &lt;- p + geom_jitter()
  
  
      multiplot(p, p)
  
  
    })
  
  
  })
  </code></pre>