emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Displaying regression results from R in beamer
@ 2013-06-23  2:14 Vikas Rawal
  2013-06-23 15:15 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Vikas Rawal @ 2013-06-23  2:14 UTC (permalink / raw)
  To: emacs-orgmode

I want to display regression results from an R source block in a
beamer export. The best I could find was to use R libraries stargazer
or texreg to produce latex code from the regression results.

However, when I use 

#+BEGIN_SRC R :results value latex
<R source block here>
#+END_SRC

The output I get is enclosed in | on both sides:

#+BEGIN_LaTeX
|                                                                                                             |
| % Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu |
| % Date and time: Sun, Jun 23, 2013 - 07:41:02                                                               |
| \begin{table}[htb] \centering                                                                               |
| \caption{}                                                                                                  |
| \label{}                                                                                                    |
| \footnotesize                                                                                               |
|                                                                                                             |
| \begin{tabular}{@{\extracolsep{5pt}}lc}                                                                     |
| \\[-1.8ex]\hline                                                                                            |
| \hline \\[-1.8ex]                                                                                           |
| & \multicolumn{1}{c}{\textit{Dependent variable:}} \\                                                       |
| \cline{2-2}                                                                                                 |
| \\[-1.8ex] & Days\_per\_capita\_men \\                                                                      |
| \hline \\[-1.8ex]                                                                                           |
| Land\_cultivated & $0.015$ \\                                                                               |
| & $(0.027)$ \\                                                                                              |
| & \\                                                                                                        |
| Social\_groupScheduled tribe & $0.336^{***}$ \\                                                             |
| & $(0.076)$ \\                                                                                              |
| & \\                                                                                                        |
| Social\_groupMuslim & $-0.022$ \\                                                                           |
| & $(0.098)$ \\                                                                                              |
| & \\                                                                                                        |
| Social\_groupOthers & $0.141^{**}$ \\                                                                       |
| & $(0.063)$ \\                                                                                              |
| & \\                                                                                                        |
| Household\_type2 & $0.775^{***}$ \\                                                                         |
| & $(0.105)$ \\                                                                                              |
| & \\                                                                                                        |
| Household\_type3 & $0.987^{***}$ \\                                                                         |
| & $(0.100)$ \\                                                                                              |
| & \\                                                                                                        |
| Household\_type4 & $-0.277^{**}$ \\                                                                         |
| & $(0.120)$ \\                                                                                              |
| & \\                                                                                                        |
| Household\_type9 & $0.684^{***}$ \\                                                                         |
| & $(0.175)$ \\                                                                                              |
| & \\                                                                                                        |
| Constant & $4.538^{***}$ \\                                                                                 |
| & $(0.102)$ \\                                                                                              |
| & \\                                                                                                        |
| \hline \\[-1.8ex]                                                                                           |
| Observations & $4,556$ \\                                                                                   |
| R$^{2}$ & $0.066$ \\                                                                                        |
| Adjusted R$^{2}$ & $0.065$ \\                                                                               |
| Residual Std. Error & $1.740 (df = 4547)$ \\                                                                |
| F statistic & $40.440^{***} (df = 8; 4547)$ \\                                                              |
| \hline                                                                                                      |
| \hline \\[-1.8ex]                                                                                           |
| \textit{Note:}  & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\                   |
| \normalsize                                                                                                 |
| \end{tabular}                                                                                               |
| \end{table}                                                                                                 |
#+END_LaTeX


How do I get rid of these |s? The R terminal where the source block is
bring processed shows correct latex code, but when it is inserted into
the orgmode file, it comes enclosed in | characters.

Will appreciate any help.

Vikas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Displaying regression results from R in beamer
  2013-06-23  2:14 Displaying regression results from R in beamer Vikas Rawal
@ 2013-06-23 15:15 ` Eric Schulte
  2013-06-24  4:27   ` Vikas Rawal
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2013-06-23 15:15 UTC (permalink / raw)
  To: emacs-orgmode

Vikas Rawal <vikaslists@agrarianresearch.org> writes:

> I want to display regression results from an R source block in a
> beamer export. The best I could find was to use R libraries stargazer
> or texreg to produce latex code from the regression results.
>
> However, when I use 
>
> #+BEGIN_SRC R :results value latex

Your problem is the word "value", which will cause thing which look like
tables to be interpreted as tables.  I'd try removing value, or adding
"scalar" to :results.

Cheers,

> 
> <R source block here> #+END_SRC
>
> The output I get is enclosed in | on both sides:
>
> #+BEGIN_LaTeX
> |                                                                                                             |
> | % Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu |
> | % Date and time: Sun, Jun 23, 2013 - 07:41:02                                                               |
> | \begin{table}[htb] \centering                                                                               |
> | \caption{}                                                                                                  |
> | \label{}                                                                                                    |
> | \footnotesize                                                                                               |
> |                                                                                                             |
> | \begin{tabular}{@{\extracolsep{5pt}}lc}                                                                     |
> | \\[-1.8ex]\hline                                                                                            |
> | \hline \\[-1.8ex]                                                                                           |
> | & \multicolumn{1}{c}{\textit{Dependent variable:}} \\                                                       |
> | \cline{2-2}                                                                                                 |
> | \\[-1.8ex] & Days\_per\_capita\_men \\                                                                      |
> | \hline \\[-1.8ex]                                                                                           |
> | Land\_cultivated & $0.015$ \\                                                                               |
> | & $(0.027)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Social\_groupScheduled tribe & $0.336^{***}$ \\                                                             |
> | & $(0.076)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Social\_groupMuslim & $-0.022$ \\                                                                           |
> | & $(0.098)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Social\_groupOthers & $0.141^{**}$ \\                                                                       |
> | & $(0.063)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Household\_type2 & $0.775^{***}$ \\                                                                         |
> | & $(0.105)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Household\_type3 & $0.987^{***}$ \\                                                                         |
> | & $(0.100)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Household\_type4 & $-0.277^{**}$ \\                                                                         |
> | & $(0.120)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Household\_type9 & $0.684^{***}$ \\                                                                         |
> | & $(0.175)$ \\                                                                                              |
> | & \\                                                                                                        |
> | Constant & $4.538^{***}$ \\                                                                                 |
> | & $(0.102)$ \\                                                                                              |
> | & \\                                                                                                        |
> | \hline \\[-1.8ex]                                                                                           |
> | Observations & $4,556$ \\                                                                                   |
> | R$^{2}$ & $0.066$ \\                                                                                        |
> | Adjusted R$^{2}$ & $0.065$ \\                                                                               |
> | Residual Std. Error & $1.740 (df = 4547)$ \\                                                                |
> | F statistic & $40.440^{***} (df = 8; 4547)$ \\                                                              |
> | \hline                                                                                                      |
> | \hline \\[-1.8ex]                                                                                           |
> | \textit{Note:}  & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\                   |
> | \normalsize                                                                                                 |
> | \end{tabular}                                                                                               |
> | \end{table}                                                                                                 |
> #+END_LaTeX
>
>
> How do I get rid of these |s? The R terminal where the source block is
> bring processed shows correct latex code, but when it is inserted into
> the orgmode file, it comes enclosed in | characters.
>
> Will appreciate any help.
>
> Vikas
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Displaying regression results from R in beamer
  2013-06-23 15:15 ` Eric Schulte
@ 2013-06-24  4:27   ` Vikas Rawal
  0 siblings, 0 replies; 3+ messages in thread
From: Vikas Rawal @ 2013-06-24  4:27 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


> > #+BEGIN_SRC R :results value latex
> 
> Your problem is the word "value", which will cause thing which look like
> tables to be interpreted as tables.  I'd try removing value, or adding
> "scalar" to :results.

:results scalar latex

works beautifully. 

Thanks,

Vikas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-24  4:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-23  2:14 Displaying regression results from R in beamer Vikas Rawal
2013-06-23 15:15 ` Eric Schulte
2013-06-24  4:27   ` Vikas Rawal

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).