title: R Plumber API simpleError in .subset2(x, i, exact = exact): subscript out of bounds
body: <p>I am developing a plumber API which takes a JSON file as input and inside it is processed by an rmarkdown file to produce pdf output report.</p>
  <p>I am getting following error:</p>
  <p>simpleError in .subset2(x, i, exact = exact): subscript out of bounds</p>
  <p>This is my plumber.R file code:</p>
  <pre><code>#* @apiTitle CustomerLytics
  #* Echo back the input
  #* parse JSON
  #* @serializer  contentType list(type=&quot;json&quot;)
  #* @param file:[file]
  #* @post /pdf
  
  function(
    
    file,  
    cmede,
    cklant,
    nmede,
    nklant,
    res
           ){
    
  
      
    
      res$setHeader(&quot;CustomerLytics&quot;,&quot;attachment; filename=result.pdf&quot;)
  
    tmp=tempfile()
      
    render(&quot;triaReport7.Rmd&quot;, tmp,
                      output_format=&quot;pdf_document&quot;,
                      
               params=list(file=file,
                       cmede=cmede,
                       cklant=cklant,
                       nmede=nmede,
                       nklant=nklant)
           )
    
    file_name=paste0(tmp,&quot;.pdf&quot;)
          
    readBin(outfile, &quot;raw&quot;, n=file.info(tmp)$size)
    
  }
  </code></pre>
  <p>In R console, I see rmakdown verbose:</p>
  <p>Quitting from lines 126-400 (triaReport7.Rmd)</p>
  <p>This is the code chunk in rmarkdown where this pointing to:</p>
  <pre><code>```{r}
  df_S0_=file[[1]][[1]]
    
  df_S1_=file[[1]][[2]]
  ```
  </code></pre>
  <p>This command chunk divides the file into two separate lists df_S0_ and df_S1_. Help me out. I tried many solutions but all in vain.</p>
  <p>I have resolved this issue now. But there is another issue unfolded. When I want to get pdf through shiny app it works fine but when i do it through plumber api, I get following error now:</p>
  <pre><code>This is LuaHBTeX, Version 1.13.2 (TeX Live 2021/W32TeX) 
   restricted system commands enabled.
  &lt;simpleError: LaTeX failed to compile C:\Users\ARUNSH~1\AppData\Local\Temp\RtmpwVTRAc\file2fb452774ca6.tex.
  </code></pre>
  <p>The line &quot;restricted system commands enabled.&quot; does not appear when I do it through shiny and I get pdf output but this line appears when I do it via plumber API. I tried Yihui tips for debugging but none works.</p>