title: Error in [.data.frame: undefined columns selected for worldcloud in Shiny
body: <p>I'm creating a simple Shiny UI that allow users to either input text or upload file to create a word cloud, the sidebar shows normal, but main panel continues to show</p>
  
  <blockquote>
    <p>Error in [.data.frame: undefined columns selected'. </p>
  </blockquote>
  
  <p>Avoid initial warning with default value set in textAreaInput </p>
  
  <p>Key code as below:</p>
  
  <pre><code>ui &lt;- fluidPage(
    h1("Word Cloud"),
    sidebarLayout(
      sidebarPanel(
        # Add radio buttons input
        radioButtons(
          inputId = "source",
          label = "Word source",
          choices = c(
            "Use your own words" = "own",
            "Upload a file" = "file"
          )
        ),
        conditionalPanel(
          condition = "input.source == 'own'",
          textAreaInput("text", "Enter text",value="Paste here",rows = 7)
        ),
        conditionalPanel(
          condition = "input.source == 'file'",
          fileInput("file", "Select a txt file (encoding='UTF-8')")
        ),
        colourInput("col", "Background color", value = "white"),
        # Add a "draw" button to the app
        actionButton(inputId = "draw", label = "Draw!")
      ),
      mainPanel(
        wordcloud2Output("cloud")
      )
    )
  )
  
  library(tidyverse)
  library(jiebaR)
  mixseg = worker()
  server &lt;- function(input, output) {
    data_source &lt;- reactive({
      if (input$source == "own") {
        (data &lt;- as.data.frame(table(mixseg &lt;= input$text)))
      } else if (input$source == "file") {
        f&lt;-read_file(input$file$datapath)
        if(is.null(f)){
          return(NULL)
        }else{
          data &lt;- as.data.frame(table(mixseg &lt;=f))
        }
      } 
      return(data)
    })
  
    output$cloud &lt;- renderWordcloud2({
      input$draw
      isolate(
        wordcloud2(data_source(), backgroundColor =input$col))
    })
  }
  </code></pre>