title: Call R Shiny App with Argument
body: <p>Update, I tried writing app using object (explained <a href="https://github.com/jcheng5/seattle-meetup/blob/master/diamonds2/explore.R" rel="nofollow noreferrer">here</a>), but I get same error</p>
  
  <p>Updated internal app function</p>
  
  <pre><code>CustomPalette &lt;- function(new_pal=NULL){
    if (interactive()){
      colorfile &lt;- paste(getwd(),"colorfile.txt",sep="/")
      if (!file.exists(colorfile)){
        file.create(colorfile)
      }
      app &lt;- list(
        ui = fluidPage(
          titlePanel("Cherry Pick Your Own Palette!"),
          sidebarPanel (hr(),
                        selectInput('col', 'Options', new_pal, multiple=TRUE, selectize=FALSE, size = 15)
          ),
          mainPanel(
            h5('Your custom colors',style = "font-weight: bold;"),
            fluidRow(column(12,verbatimTextOutput("col"))))
        ),
        server = function(input,output,session){
          outputdata&lt;-  reactive({
            input$col
          })
  
          output$col &lt;- { 
            renderPrint(outputdata())
          }
          session$onSessionEnded(function(){
            message &lt;- paste(isolate(outputdata())," ")
            cat(message,file=colorfile, append=TRUE)
            customcolors &lt;- scan(file=colorfile," ")
            stopApp(customcolors)
            customcolors
          })
        }
      )
    }
  
  }
  </code></pre>
  
  <hr>
  
  <p>I am attempting to call R Shiny App with an argument, i.e. <code>customcolors &lt;- runApp(CustomPalette(new_pal = NULL))</code></p>
  
  <p>This launches shiny app, allowing user to select individual colors, which the app returns as a vector</p>
  
  <p>Unfortunately, <code>devtools::check()</code> gives error for <a href="https://github.com/ArtieLadie/RanglaPunjab/blob/master/R/RanglaPunjab.R" rel="nofollow noreferrer">entire R script</a></p>
  
  <pre><code>&gt; CherryPickPalette("GoldenTemple","AmritsariPedeWaliLassi")
  Error in UseMethod("as.shiny.appobj", x) : 
    no applicable method for 'as.shiny.appobj' applied to an object of class "NULL"
  Calls: CherryPickPalette -&gt; runApp -&gt; as.shiny.appobj
  Execution halted
  </code></pre>
  
  <p>Below is <code>CherryPickPalette</code> function, which invokes <code>CustomPalette</code> function that contains shiny app (also included).</p>
  
  <p>Ultimately, the user should be able to execute <code>CherryPickPalette(name, name2, name3)</code>, shiny app should appear, user should pick whatever colors they want, and variable should be saved and used within entire script.</p>
  
  <pre><code># visible to user
  CherryPickPalette &lt;- function (name, name2=NULL, name3=NULL){
  
    ### snipped code
  
    customcolors &lt;- runApp(CustomPalette(new_pal = NULL))
  
    customcolors
  
  }
  
  # hidden from user
  CustomPalette &lt;- function(new_pal){
    if (interactive()){
      colorfile &lt;- paste(getwd(),"colorfile.txt",sep="/")
      if (!file.exists(colorfile)){
        file.create(colorfile)
      }
      shinyApp(
        ui = fluidPage(
          titlePanel("Cherry Pick Your Own Palette!"),
          sidebarPanel (hr(),
                        selectInput('col', 'Options', new_pal, multiple=TRUE, selectize=FALSE, size = 15)
          ),
          mainPanel(
            h5('Your custom colors',style = "font-weight: bold;"),
            fluidRow(column(12,verbatimTextOutput("col"))))
        ),
        server = function(input,output,session){
          outputdata&lt;-  reactive({
            input$col
          })
  
          output$col &lt;- { 
            renderPrint(outputdata())
          }
          session$onSessionEnded(function(){
            message &lt;- paste(isolate(outputdata())," ")
            cat(message,file=colorfile, append=TRUE)
            customcolors &lt;- scan(file=colorfile," ")
            stopApp(customcolors)
            customcolors
          })
        }
      )
    }
  }
  </code></pre>