title: xtable align right and set width Rmarkdown
body: <p>I have a dataframe that I want to turn into a table with right alignment in Rmarkdown</p>
  
  <pre><code>---
  title: "Test"
  output: 
    pdf_document
  ---
  
  ```{r testing, results='asis'}
  library(xtable)
  df &lt;- structure(list(ID = c(101L, 102L, 103L, 104L, 105L, 106L), 
                         Gr1 = c(10.76,983.4, 34.000, 20, 23.8457, 13.32),
                         Gr2 = c(NA,NA, NA, 20L, NA, NA)
                         ), 
                    .Names = c("ID", "Grade1", "Grade2"), 
                    class = c("tbl_df", "data.frame"), 
                    row.names = c(NA, -6L))
  xtable(df,
         align = c('l', 'p{1.5in}', rep('r{0.5in}',2)), 
         digits=c(0,0,1,0))
  ```
  </code></pre>
  
  <p>This gives me an error on the <code>rep('r{0.5in}',2)</code></p>
  
  <pre><code>! LaTeX Error: Illegal character in array arg.
  </code></pre>
  
  <p>I've also tried:  <code>align = c('l|', 'p{1.5in}|', rep('R{0.5in}|',2))</code></p>
  
  <p>The following works fine: <code>align = c('l', 'p{1.5in}', rep('p{0.5in}',2))</code></p>
  
  <p><a href="https://i.stack.imgur.com/n0e5X.png" rel="nofollow"><img src="https://i.stack.imgur.com/n0e5X.png" alt="The data isn&#39;t right aligned"></a></p>
  
  <p>But the data is left aligned</p>