* org-babel export table from R to LaTeX @ 2012-02-14 15:31 Riccardo Romoli [not found] ` <87vcn99zv0.fsf@xtof-netbook.home> 0 siblings, 1 reply; 5+ messages in thread From: Riccardo Romoli @ 2012-02-14 15:31 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1346 bytes --] Hi, I work with org-babel and R. In the R session I create a table that I have to export to LaTeX. This is the code I use: #+headers: :results latex #+begin_src R :session *R* :exports results ..... print(xtable(summary(mypca))) #+end_src I do not understand why the exported table is delimited by "|": |% latex table generated in R 2.14.1 by xtable 1.6-0 package | | % Tue Feb 14 16:21:48 2012 | | \begin{table}[ht] | | \begin{center} | | \begin{tabular}{rrrrrrrrrrrrrrrrr} | | \hline | | & PC1 & PC2 & PC3 & PC4 & PC5 & PC6 & PC7 & PC8 & PC9 & PC10 & PC11 & PC12 & PC13 & PC14 & PC15 & PC16 \\ | | \hline | | Standard deviation & 3.4693 & 2.8113 & 2.5561 & 2.2668 & 2.0015 & 1.9236 & 1.7287 & 1.6220 & 1.4288 & 1.3456 & 1.2596 & 1.2195 & 1.1278 & 1.0778 & 0.8390 & 0.0000 \\ | | Proportion of Variance & 0.2188 & 0.1437 & 0.1188 & 0.0934 & 0.0728 & 0.0673 & 0.0543 & 0.0478 & 0.0371 & 0.0329 & 0.0289 & 0.0270 & 0.0231 & 0.0211 & 0.0128 & 0.0000 \\ | | Cumulative Proportion & 0.2188 & 0.3625 & 0.4813 & 0.5747 & 0.6476 & 0.7149 & 0.7692 & 0.8170 & 0.8541 & 0.8871 & 0.9159 & 0.9429 & 0.9661 & 0.9872 & 1.0000 & 1.0000 \\ | | \hline | | \end{tabular} | | \end{center} | | \end{table} | | | Should I change some headers settings?? Best [-- Attachment #2: Type: text/html, Size: 1759 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <87vcn99zv0.fsf@xtof-netbook.home>]
* Re: org-babel export table from R to LaTeX [not found] ` <87vcn99zv0.fsf@xtof-netbook.home> @ 2012-02-14 17:10 ` Riccardo Romoli 2012-02-14 17:25 ` Christophe Pouzat 0 siblings, 1 reply; 5+ messages in thread From: Riccardo Romoli @ 2012-02-14 17:10 UTC (permalink / raw) To: Christophe Pouzat; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2469 bytes --] If I set :export latex when I exports to LaTeX I have only the R code, not the table. Best 2012/2/14 Christophe Pouzat <christophe.pouzat@gmail.com> > Riccardo Romoli <ric.romoli@gmail.com> writes: > > > Hi, I work with org-babel and R. > > In the R session I create a table that I have to export to LaTeX. > > This is the code I use: > > > > #+headers: :results latex > > #+begin_src R :session *R* :exports results > > ..... > > print(xtable(summary(mypca))) > > #+end_src > > > > I do not understand why the exported table is delimited by "|": > > > > |% latex table generated in R 2.14.1 by xtable 1.6-0 package | > > | % Tue Feb 14 16:21:48 2012 | > > | \begin{table}[ht] | > > | \begin{center} | > > | \begin{tabular}{rrrrrrrrrrrrrrrrr} | > > | \hline | > > | & PC1 & PC2 & PC3 & PC4 & PC5 & PC6 & PC7 & PC8 & PC9 & PC10 & > > PC11 & PC12 & PC13 & PC14 & PC15 & PC16 \\ | > > | \hline | > > | Standard deviation & 3.4693 & 2.8113 & 2.5561 & 2.2668 & > > 2.0015 & 1.9236 & 1.7287 & 1.6220 & 1.4288 & 1.3456 & 1.2596 & > > 1.2195 & 1.1278 & 1.0778 & 0.8390 & 0.0000 \\ | > > | Proportion of Variance & 0.2188 & 0.1437 & 0.1188 & 0.0934 & > > 0.0728 & 0.0673 & 0.0543 & 0.0478 & 0.0371 & 0.0329 & 0.0289 & > > 0.0270 & 0.0231 & 0.0211 & 0.0128 & 0.0000 \\ | > > | Cumulative Proportion & 0.2188 & 0.3625 & 0.4813 & 0.5747 & > > 0.6476 & 0.7149 & 0.7692 & 0.8170 & 0.8541 & 0.8871 & 0.9159 & > > 0.9429 & 0.9661 & 0.9872 & 1.0000 & 1.0000 \\ | > > | \hline | > > | \end{tabular} | > > | \end{center} | > > | \end{table} | > > | | > > > > Should I change some headers settings?? > > > > Best > > > > Hi Riccardo, > > Try ":exports latex" instead of ":exports results" > > Christophe > -- > > Most people are not natural-born statisticians. Left to our own > devices we are not very good at picking out patterns from a sea of > noisy data. To put it another way, we are all too good at picking out > non-existent patterns that happen to suit our purposes. > Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap > > -- > > Christophe Pouzat > MAP5 - Mathématiques Appliquées à Paris 5 > CNRS UMR 8145 > 45, rue des Saints-Pères > 75006 PARIS > France > > tel: +33142863828 > mobile: +33662941034 > web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html > [-- Attachment #2: Type: text/html, Size: 3613 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-babel export table from R to LaTeX 2012-02-14 17:10 ` Riccardo Romoli @ 2012-02-14 17:25 ` Christophe Pouzat 2012-02-14 22:18 ` Andreas Leha 0 siblings, 1 reply; 5+ messages in thread From: Christophe Pouzat @ 2012-02-14 17:25 UTC (permalink / raw) To: Riccardo Romoli; +Cc: emacs-orgmode Sorry, Checking foo.org (http://orgmode.org/w/?p=worg.git;a=blob_plain;f=org-contrib/babel/examples/foo.org;hb=HEAD) I got the correct way to do it: #+begin_src R :results output latex :exports results library(xtable) xtable(foo, caption = "ANOVA Table", label = "tab:one", digits = c(0, 0, 2, 0, 2, 3, 3)) #+end_src Does it solve your problem? Christophe Riccardo Romoli <ric.romoli@gmail.com> writes: > If I set :export latex when I exports to LaTeX I have only the R code, not the > table. > > Best > > 2012/2/14 Christophe Pouzat <christophe.pouzat@gmail.com> > > Riccardo Romoli <ric.romoli@gmail.com> writes: > > > Hi, I work with org-babel and R. > > In the R session I create a table that I have to export to LaTeX. > > This is the code I use: > > > > #+headers: :results latex > > #+begin_src R :session *R* :exports results > > ..... > > print(xtable(summary(mypca))) > > #+end_src > > > > I do not understand why the exported table is delimited by "|": > > > > |% latex table generated in R 2.14.1 by xtable 1.6-0 package | > > | % Tue Feb 14 16:21:48 2012 | > > | \begin{table}[ht] | > > | \begin{center} | > > | \begin{tabular}{rrrrrrrrrrrrrrrrr} | > > | \hline | > > | & PC1 & PC2 & PC3 & PC4 & PC5 & PC6 & PC7 & PC8 & PC9 & PC10 & > > PC11 & PC12 & PC13 & PC14 & PC15 & PC16 \\ | > > | \hline | > > | Standard deviation & 3.4693 & 2.8113 & 2.5561 & 2.2668 & > > 2.0015 & 1.9236 & 1.7287 & 1.6220 & 1.4288 & 1.3456 & 1.2596 & > > 1.2195 & 1.1278 & 1.0778 & 0.8390 & 0.0000 \\ | > > | Proportion of Variance & 0.2188 & 0.1437 & 0.1188 & 0.0934 & > > 0.0728 & 0.0673 & 0.0543 & 0.0478 & 0.0371 & 0.0329 & 0.0289 & > > 0.0270 & 0.0231 & 0.0211 & 0.0128 & 0.0000 \\ | > > | Cumulative Proportion & 0.2188 & 0.3625 & 0.4813 & 0.5747 & > > 0.6476 & 0.7149 & 0.7692 & 0.8170 & 0.8541 & 0.8871 & 0.9159 & > > 0.9429 & 0.9661 & 0.9872 & 1.0000 & 1.0000 \\ | > > | \hline | > > | \end{tabular} | > > | \end{center} | > > | \end{table} | > > | | > > > > Should I change some headers settings?? > > > > Best > > > > Hi Riccardo, > > Try ":exports latex" instead of ":exports results" > > Christophe > -- > > Most people are not natural-born statisticians. Left to our own > devices we are not very good at picking out patterns from a sea of > noisy data. To put it another way, we are all too good at picking out > non-existent patterns that happen to suit our purposes. > Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap > > -- > > Christophe Pouzat > MAP5 - Mathématiques Appliquées à Paris 5 > CNRS UMR 8145 > 45, rue des Saints-Pères > 75006 PARIS > France > > tel: +33142863828 > mobile: +33662941034 > web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html > > -- Most people are not natural-born statisticians. Left to our own devices we are not very good at picking out patterns from a sea of noisy data. To put it another way, we are all too good at picking out non-existent patterns that happen to suit our purposes. Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap -- Christophe Pouzat MAP5 - Mathématiques Appliquées à Paris 5 CNRS UMR 8145 45, rue des Saints-Pères 75006 PARIS France tel: +33142863828 mobile: +33662941034 web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-babel export table from R to LaTeX 2012-02-14 17:25 ` Christophe Pouzat @ 2012-02-14 22:18 ` Andreas Leha 2012-02-15 11:00 ` Riccardo Romoli 0 siblings, 1 reply; 5+ messages in thread From: Andreas Leha @ 2012-02-14 22:18 UTC (permalink / raw) To: emacs-orgmode Christophe Pouzat <christophe.pouzat@gmail.com> writes: > Sorry, > > Checking foo.org > (http://orgmode.org/w/?p=worg.git;a=blob_plain;f=org-contrib/babel/examples/foo.org;hb=HEAD) > I got the correct way to do it: > > #+begin_src R :results output latex :exports results > library(xtable) > xtable(foo, caption = "ANOVA Table", label = "tab:one", > digits = c(0, 0, 2, 0, 2, 3, 3)) > #+end_src > > Does it solve your problem? > > Christophe > > Riccardo Romoli <ric.romoli@gmail.com> writes: > >> If I set :export latex when I exports to LaTeX I have only the R code, not the >> table. >> >> Best >> >> 2012/2/14 Christophe Pouzat <christophe.pouzat@gmail.com> >> >> Riccardo Romoli <ric.romoli@gmail.com> writes: >> >> > Hi, I work with org-babel and R. >> > In the R session I create a table that I have to export to LaTeX. >> > This is the code I use: >> > >> > #+headers: :results latex >> > #+begin_src R :session *R* :exports results >> > ..... >> > print(xtable(summary(mypca))) >> > #+end_src >> > >> > I do not understand why the exported table is delimited by "|": >> > >> > |% latex table generated in R 2.14.1 by xtable 1.6-0 package | >> > | % Tue Feb 14 16:21:48 2012 | >> > | \begin{table}[ht] | >> > | \begin{center} | >> > | \begin{tabular}{rrrrrrrrrrrrrrrrr} | >> > | \hline | >> > | & PC1 & PC2 & PC3 & PC4 & PC5 & PC6 & PC7 & PC8 & PC9 & PC10 & >> > PC11 & PC12 & PC13 & PC14 & PC15 & PC16 \\ | >> > | \hline | >> > | Standard deviation & 3.4693 & 2.8113 & 2.5561 & 2.2668 & >> > 2.0015 & 1.9236 & 1.7287 & 1.6220 & 1.4288 & 1.3456 & 1.2596 & >> > 1.2195 & 1.1278 & 1.0778 & 0.8390 & 0.0000 \\ | >> > | Proportion of Variance & 0.2188 & 0.1437 & 0.1188 & 0.0934 & >> > 0.0728 & 0.0673 & 0.0543 & 0.0478 & 0.0371 & 0.0329 & 0.0289 & >> > 0.0270 & 0.0231 & 0.0211 & 0.0128 & 0.0000 \\ | >> > | Cumulative Proportion & 0.2188 & 0.3625 & 0.4813 & 0.5747 & >> > 0.6476 & 0.7149 & 0.7692 & 0.8170 & 0.8541 & 0.8871 & 0.9159 & >> > 0.9429 & 0.9661 & 0.9872 & 1.0000 & 1.0000 \\ | >> > | \hline | >> > | \end{tabular} | >> > | \end{center} | >> > | \end{table} | >> > | | >> > >> > Should I change some headers settings?? >> > >> > Best >> > >> >> Hi Riccardo, >> >> Try ":exports latex" instead of ":exports results" >> >> Christophe >> -- >> >> Most people are not natural-born statisticians. Left to our own >> devices we are not very good at picking out patterns from a sea of >> noisy data. To put it another way, we are all too good at picking out >> non-existent patterns that happen to suit our purposes. >> Bradley Efron & Robert Tibshirani (1993) An Introduction to the Bootstrap >> >> -- >> >> Christophe Pouzat >> MAP5 - Mathématiques Appliquées à Paris 5 >> CNRS UMR 8145 >> 45, rue des Saints-Pères >> 75006 PARIS >> France >> >> tel: +33142863828 >> mobile: +33662941034 >> web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html >> >> Hi Riccardo, additionally, if you do not want to get too tightly bound to LaTeX, check out the ascii-package, e.g. #+begin_src R :results output org wrap :exports results library(ascii) ## from the lm help page: ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2,10,20, labels=c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1) # omitting intercept print(ascii(anova(lm.D9)), type="org") #+end_src Cheers, Andreas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-babel export table from R to LaTeX 2012-02-14 22:18 ` Andreas Leha @ 2012-02-15 11:00 ` Riccardo Romoli 0 siblings, 0 replies; 5+ messages in thread From: Riccardo Romoli @ 2012-02-15 11:00 UTC (permalink / raw) To: Andreas Leha; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 4463 bytes --] Thanks for your suggestion, I solved the problem using: #+headers: :results output latex #+begin_src R :session *R* :exports results ... print(xtable(summary(mypca))) #+end_src Regards Riccardo 2012/2/14 Andreas Leha <andreas.leha@med.uni-goettingen.de> > Christophe Pouzat <christophe.pouzat@gmail.com> writes: > > > Sorry, > > > > Checking foo.org > > ( > http://orgmode.org/w/?p=worg.git;a=blob_plain;f=org-contrib/babel/examples/foo.org;hb=HEAD > ) > > I got the correct way to do it: > > > > #+begin_src R :results output latex :exports results > > library(xtable) > > xtable(foo, caption = "ANOVA Table", label = "tab:one", > > digits = c(0, 0, 2, 0, 2, 3, 3)) > > #+end_src > > > > Does it solve your problem? > > > > Christophe > > > > Riccardo Romoli <ric.romoli@gmail.com> writes: > > > >> If I set :export latex when I exports to LaTeX I have only the R code, > not the > >> table. > >> > >> Best > >> > >> 2012/2/14 Christophe Pouzat <christophe.pouzat@gmail.com> > >> > >> Riccardo Romoli <ric.romoli@gmail.com> writes: > >> > >> > Hi, I work with org-babel and R. > >> > In the R session I create a table that I have to export to LaTeX. > >> > This is the code I use: > >> > > >> > #+headers: :results latex > >> > #+begin_src R :session *R* :exports results > >> > ..... > >> > print(xtable(summary(mypca))) > >> > #+end_src > >> > > >> > I do not understand why the exported table is delimited by "|": > >> > > >> > |% latex table generated in R 2.14.1 by xtable 1.6-0 package | > >> > | % Tue Feb 14 16:21:48 2012 | > >> > | \begin{table}[ht] | > >> > | \begin{center} | > >> > | \begin{tabular}{rrrrrrrrrrrrrrrrr} | > >> > | \hline | > >> > | & PC1 & PC2 & PC3 & PC4 & PC5 & PC6 & PC7 & PC8 & PC9 & > PC10 & > >> > PC11 & PC12 & PC13 & PC14 & PC15 & PC16 \\ | > >> > | \hline | > >> > | Standard deviation & 3.4693 & 2.8113 & 2.5561 & 2.2668 & > >> > 2.0015 & 1.9236 & 1.7287 & 1.6220 & 1.4288 & 1.3456 & > 1.2596 & > >> > 1.2195 & 1.1278 & 1.0778 & 0.8390 & 0.0000 \\ | > >> > | Proportion of Variance & 0.2188 & 0.1437 & 0.1188 & > 0.0934 & > >> > 0.0728 & 0.0673 & 0.0543 & 0.0478 & 0.0371 & 0.0329 & > 0.0289 & > >> > 0.0270 & 0.0231 & 0.0211 & 0.0128 & 0.0000 \\ | > >> > | Cumulative Proportion & 0.2188 & 0.3625 & 0.4813 & 0.5747 > & > >> > 0.6476 & 0.7149 & 0.7692 & 0.8170 & 0.8541 & 0.8871 & > 0.9159 & > >> > 0.9429 & 0.9661 & 0.9872 & 1.0000 & 1.0000 \\ | > >> > | \hline | > >> > | \end{tabular} | > >> > | \end{center} | > >> > | \end{table} | > >> > | | > >> > > >> > Should I change some headers settings?? > >> > > >> > Best > >> > > >> > >> Hi Riccardo, > >> > >> Try ":exports latex" instead of ":exports results" > >> > >> Christophe > >> -- > >> > >> Most people are not natural-born statisticians. Left to our own > >> devices we are not very good at picking out patterns from a sea of > >> noisy data. To put it another way, we are all too good at picking > out > >> non-existent patterns that happen to suit our purposes. > >> Bradley Efron & Robert Tibshirani (1993) An Introduction to the > Bootstrap > >> > >> -- > >> > >> Christophe Pouzat > >> MAP5 - Mathématiques Appliquées à Paris 5 > >> CNRS UMR 8145 > >> 45, rue des Saints-Pères > >> 75006 PARIS > >> France > >> > >> tel: +33142863828 > >> mobile: +33662941034 > >> web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html > >> > >> > > Hi Riccardo, > > additionally, if you do not want to get too tightly bound to LaTeX, check > out the ascii-package, e.g. > > #+begin_src R :results output org wrap :exports results > library(ascii) > > ## from the lm help page: > ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > group <- gl(2,10,20, labels=c("Ctl","Trt")) > weight <- c(ctl, trt) > lm.D9 <- lm(weight ~ group) > lm.D90 <- lm(weight ~ group - 1) # omitting intercept > > print(ascii(anova(lm.D9)), type="org") > #+end_src > > > Cheers, > Andreas > > > [-- Attachment #2: Type: text/html, Size: 6665 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-15 11:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-14 15:31 org-babel export table from R to LaTeX Riccardo Romoli [not found] ` <87vcn99zv0.fsf@xtof-netbook.home> 2012-02-14 17:10 ` Riccardo Romoli 2012-02-14 17:25 ` Christophe Pouzat 2012-02-14 22:18 ` Andreas Leha 2012-02-15 11:00 ` Riccardo Romoli
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).