title: Using stargazer with Rstudio and Knitr
body: <p>I'm struggling to use stargazer output in knitr, using RStudio. For example, I paste the code below into a .Rmd file, then click Knit HTML. The first block between [ and ] is rendered as equations. The second block is from stargazer. It remains as code. When I paste the second block, less [ and ], into a Sweave file and then click compile as PDF, the code renders as a table. I have MikTex installed and version 3 of Stargazer.</p>
  
  <p>The answer  <a href="https://stackoverflow.com/questions/14407576/inserting-stargazer-or-xable-table-into-knitr-document">inserting stargazer or xable table into knitr document</a> works for me in a Sweave file (Rnw) when clicking compile PDF. In an Rmd file, the tex is not rendered when clicking Knit HTML.</p>
  
  <p>How can I put stargazer output into a Rmd file so that Knit HTML converts the latex code to a table? (I'm new to Latex, and am not sure what code I can delete, so apologise for the long segment.)</p>
  
  <pre><code>\[
  \begin{aligned}
  \dot{x} &amp;amp; = \sigma(y-x) \\
  \dot{y} &amp;amp; = \rho x - y - xz \\
  \dot{z} &amp;amp; = -\beta z + xy
  \end{aligned}
  \]
  
  \[
  \documentclass{article}
  
  \begin{document}
  
  
  % Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
  % Date and time: Sun, Feb 03, 2013 - 11:34:52 AM
  \begin{table}[htb] \centering 
    \caption{} 
    \label{} 
  \footnotesize 
  
  \begin{tabular}{@{\extracolsep{5pt}}lc} 
  \\[-1.8ex]\hline 
  \hline \\[-1.8ex] 
   &amp; \multicolumn{1}{c}{\textit{Dependent variable:}} \\ 
  \cline{2-2} 
  \\[-1.8ex] &amp; Rate \\ 
  \hline \\[-1.8ex] 
   pole &amp; $0.071^{***}$ \\ 
    &amp; $(0.020)$ \\ 
    &amp; \\ 
   post &amp; $0.095^{***}$ \\ 
    &amp; $(0.019)$ \\ 
    &amp; \\ 
   Constant &amp; $-5.784^{***}$ \\ 
    &amp; $(1.667)$ \\ 
    &amp; \\ 
  \hline \\[-1.8ex] 
  Observations &amp; $46$ \\ 
  Residual Std. Error &amp; $2.378 (df = 43)$ \\ 
  \hline 
  \hline \\[-1.8ex] 
  \textit{Note:}  &amp; \multicolumn{1}{r}{$^{*}$p$&lt;$0.1; $^{**}$p$&lt;$0.05; $^{***}$p$&lt;$0.01} \\ 
  \normalsize 
  \end{tabular} 
  \end{table} 
  
  \end{document}
  \]
  </code></pre>