title: R sprintf maximal input length
body: <p>R's <code>sprintf</code> has preset maximal input length set as 8192 bytes:</p>
  
  <pre><code>sprintf(x, y)
  Error in sprintf(x, y) : 'fmt' length exceeds maximal format length 8192
  </code></pre>
  
  <p>what is the workaround for longer input strings? I learned that in C there is <a href="http://www.cplusplus.com/reference/cstdio/snprintf/" rel="nofollow">snprintf</a> function for such cases, but this seems not to be available in R, isn't it?</p>
  
  <p><em>Example</em></p>
  
  <p>The input file is something like</p>
  
  <pre><code>select *
  from some_table
  where a = '%s' and
        b = %d and
        c in (%s) and
        d = %s and
        e &gt;= %0.2f
  </code></pre>
  
  <p>but <em>much</em> more complicated and <em>much</em> longer. I need to replace all the values with some values. <code>sprintf</code> is great for that but one of the input scripts I am working with is too long. I need multiple different arguments to be replaced and the arguments have different formats (string, double, float). The values to be replaced are located in different parts of the input file so I need to search and replace them in given order. I know about <a href="https://cran.r-project.org/web/packages/RODBCext/vignettes/Parameterized_SQL_queries.html" rel="nofollow">this approach</a> to parametrized queries, but need to use different library (<code>RPostgreSQL</code>).</p>