title: How to create dynamic table heading in R Markdown
body: <p>I would like to create a dynamic table heading, which updates based on the number of regression coefficients (k,a,b,c,d,..,n,n+1) and regression equations(U4ST,U4STAW,...n,n+1).</p>
  <p>Is it possible to use the &quot;Y&quot; and &quot;X&quot; variables provided in the Code below to make the table dynamic so that it can change if the length of the X and Y variables decrease or increase? Thank you kindly.</p>
  <pre><code>txt = &quot;Base Condition,k,a,b,c
  U4ST,0.29,-3.12,0.27,0.16
  U4STAW,1.24,-12.37,1.22,0.27
  U3ST,3.18,-5.35,0.34,0.28
  U4SG,0.38,-3.47,0.42,0.14
  SHS U4SG,0.38,-3.47,0.42,0.14
  SHS U4ST,0.29,-3.12,0.27,0.16&quot;
  txtTable=TextToTable(txt, sep=&quot;,&quot;, dimnames=c(&quot;Index&quot;,&quot;Safety Analyst SPF  Coefficients&quot;), header=TRUE)
  
  
  Y=length(txtTable[,1])
  X=length(txtTable[2,])-1
  
  #table
  txtTable %&gt;% kable(align= 'c', caption = &quot;Information System X Regression Coefficients for Y Base Condition regression equations&quot;)```
  </code></pre>