Re: [O] org-babel export table from R to LaTeX
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.l...@med.uni-goettingen.de Christophe Pouzat christophe.pou...@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.rom...@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.pou...@gmail.com Riccardo Romoli ric.rom...@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}{r} | | \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. \\ | | 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. \\ | | 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. 1. \\ | | \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
[O] highlight latex code
Hi, is there a way to highlight latex code like \ref{}, \si{}, \ce{}, and so on, such as in org *bold* and /emph/? Regards Riccardo
[O] org-babel export table from R to LaTeX
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}{r} | | \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. \\ | | 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. \\ | | 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. 1. \\ | | \hline | | \end{tabular} | | \end{center} | | \end{table} | | | Should I change some headers settings?? Best
Re: [O] org-babel export table from R to LaTeX
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.pou...@gmail.com Riccardo Romoli ric.rom...@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}{r} | | \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. \\ | | 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. \\ | | 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. 1. \\ | | \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
Re: [O] R export graphics
Hi Thomas, thanks for your fast replay. I had thought of this solution too but, since I have many folders that I need to move between, I need to have a pivot to start with. Best Riccardo 2012/2/13 Thomas S. Dye t...@tsdye.com Riccardo Romoli ric.rom...@gmail.com writes: Hi, I have some trouble exporting figures from an R-org-babel session. The code I use to generate the figure is: #+name: my figure #+headers: :results graphics :file /Users/riccardoromoli/Documents/ Dropbox/PhD/myFigure.pdf #+begin_src R :session *R* :exports results ... #+end_src So, if I use : file /User/riccardoromoli/Documents/, all works right, but, if I use ~/Documents/. the R console says: Error in pdf(file = ~/Dropbox/PhD/myFigure.pdf) : cannot open file ~/Dropbox/PhD/myFigure.pdf' I usually work in the DropBox folder because at work I have a linux machine instead at my home I have an OsX machine, so if I could use ~, I should not change the code every time I switch between the two different computer. Best Riccardo Aloha Riccardo, If you work in your Dropbox/PhD folder (your .org files are there), then you should be able to do :file myFigure.pdf on both systems. hth, Tom -- Thomas S. Dye http://www.tsdye.com
[O] R export graphics
Hi, I have some trouble exporting figures from an R-org-babel session. The code I use to generate the figure is: #+name: my figure #+headers: :results graphics :file /Users/riccardoromoli/Documents/ Dropbox/PhD/myFigure.pdf #+begin_src R :session *R* :exports results ... #+end_src So, if I use : file /User/riccardoromoli/Documents/, all works right, but, if I use ~/Documents/. the R console says: Error in pdf(file = ~/Dropbox/PhD/myFigure.pdf) : cannot open file '~/Dropbox/PhD/myFigure.pdf' I usually work in the DropBox folder because at work I have a linux machine instead at my home I have an OsX machine, so if I could use ~, I should not change the code every time I switch between the two different computer. Best Riccardo
Re: [O] AUCTex within org-babel
Hi, Jonas if you enter in the AUCTeX buffer (C-c') and than you use the AUCTeX C-c C-e, you can choose the environment you need in the emacs minibuffer such as in LaTeX. Best Riccardo 2012/2/8 Jonas Hörsch co...@online.de Hi list, On Wed, Feb 08 2012, Riccardo Romoli wrote: thanks a lot for your answer!! I completely ignore that C-c' lunch the small buffer for all the code within the src blocks. I belive it was used only for ESS the only remaining problem is that the AUCTeX mode tries to be smart about what environments it allows to insert. f.ex. inserting #+begin_src latex #+end_src then C-', brings one to a source buffer with AUCTeX-mode enabled. But a C-c C-e to insert an environment doesn't want to complete on itemize or figure, but instead only allows to choose document (Which would be perfectly sane under the assumption that the buffer contains the whole tex-document). Does anybody know how to deactivate this feature of AUCTeX? Perhaps setting TeX-master-file to something special? Thanks, Jonas
Re: [O] AUCTex within org-babel
I have a further question: how can I export a code like this: #+begin_src latex \begin{figure} \centering \includegraphics[width=1\textwidth]{foo.jpg} \caption{Figure example} \label{fig:foo} \end{figure} #+end_src to LaTeX to obtain a working figure code?? Best Riccardo 2012/2/9 Jonas Hörsch co...@online.de hi riccardo, On Thu, Feb 09 2012, Riccardo Romoli wrote: if you enter in the AUCTeX buffer (C-c') and than you use the AUCTeX C-c C-e, you can choose the environment you need in the emacs minibuffer such as in LaTeX. yes, indeed. and my claim was, that the completion facility of AUCTeX then only shows the environment \begin{document}..\end{document} and not f.ex. figure. but when i tried to verify that claim right now, it curiously seems not to be true any longer. so sorry for the noise, my problem (if it ever was one) is solved. cheers, jonas
Re: [O] AUCTex within org-babel
Thanks Jonas!! I do not understand why the code works only if I use: #+begin_latex #+end-latex instead of : #+begin_src latex :exports results :results latex #+end_src mind that you could also use org constructs, for instance #+CAPTION: Figure example #+LABEL: fig:foo [[foo.jpg]] I prefer to use the original LaTeX code!! Best Riccardo 2012/2/9 Jonas Hörsch co...@online.de On Thu, Feb 09 2012, Riccardo Romoli wrote: I have a further question: how can I export a code like this: #+begin_src latex \begin{figure} \centering \includegraphics[width=1\textwidth]{foo.jpg} \caption{Figure example} \label{fig:foo} \end{figure} #+end_src to LaTeX to obtain a working figure code?? it seems to do what you want, when you instead use #+begin_latex ... #+end_latex C-' also still does the same. only the native fontification in the org buffer doesn't work irrespective of the org-src-fontify-natively setting. perhaps there is another variable for that. mind that you could also use org constructs, for instance #+CAPTION: Figure example #+LABEL: fig:foo [[foo.jpg]] exports to something rather similar. cheers, jonas
[O] AUCTex within org-babel
Hi, is there a way to include the AUCTeX function (i.e. to create a figure or a table or insert a font...) and markup color, within an org-babel document? Best Riccardo
Re: [O] AUCTex within org-babel
Hi Eric, thanks a lot for your answer!! I completely ignore that C-c' lunch the small buffer for all the code within the src blocks. I belive it was used only for ESS Best Riccardo 2012/2/8 Eric Schulte eric.schu...@gmx.com Riccardo Romoli ric.rom...@gmail.com writes: Hi, is there a way to include the AUCTeX function (i.e. to create a figure or a table or insert a font...) and markup color, within an org-babel document? If I understand your question correctly you want AUCTeX mode to be active in an Org-mode document. Generally this is not possible as Org-mode is the active mode and AUCTeX and Org would conflict in many ways. If you want syntax highlighting for a particular chunk of latex code, you can may it in a src block #+begin_src latex your latex here... #+end_src and then customize the `org-src-fontify-natively' variable. Pressing C-c ' from withing the code block will then launch a small buffer in AUCTeX mode. Best, Best Riccardo -- Eric Schulte http://cs.unm.edu/~eschulte/
Re: [O] Generating plot with org-babel-R
Hi Thomas, thanks a lot for your help!! Using the JSS and the org manual I solved all my problem (at least for now!! :)) Best Riccardo 2012/2/5 Thomas S. Dye t...@tsdye.com Hi Riccardo, Thanks for the URL. Org mode has evolved since this article was written. It should probably be revised or taken off Worg. I've copied Eric Schulte, who is better able than me to determine the correct course of action here. In the meantime, an up-to-date description of how Org mode can be used to write literate programs has appeared in the Journal of Statistical Software. You can find it here: http://www.jstatsoft.org/v46/i03 Perhaps you could use the examples in the JSS article to get started? If these don't work for you, or if they raise questions that are difficult to answer, please do come back to the list with your queries. All the best, Tom Riccardo Romoli ric.rom...@gmail.com writes: Hi, this is the URL: http://orgmode.org/worg/org-contrib/babel/how-to-use-Org-Babel-for-R.html Best R 2012/2/5 Thomas S. Dye t...@tsdye.com Hi Riccardo, This code appears to be outdated. I don't recall this code on the org site. Could you send a URL? All the best, Tom Riccardo Romoli ric.rom...@gmail.com writes: Hi, I'm trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong? Best Riccardo Hi, I#39;m trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: mailto:your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong?BestRiccardo -- Thomas S. Dye http://www.tsdye.com Hi, this is the URL: http://orgmode.org/worg/org-contrib/babel/how-to-use-Org-Babel-for-R.htmlBestR 2012/2/5 Thomas S. Dye span dir=ltrmailto:t...@tsdye.com/spanHi Riccardo, This code appears to be outdated. I don#39;t recall this code on the org site. Could you send a URL? All the best, Tom Riccardo Romoli mailto:ric.rom...@gmail.com writes: Hi, I#39;m trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: mailto:your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong? Best Riccardo Hi, I#39;m trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: mailto:mailto:your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R
Re: [O] Generating plot with org-babel-R
Hi, this is the URL: http://orgmode.org/worg/org-contrib/babel/how-to-use-Org-Babel-for-R.html Best R 2012/2/5 Thomas S. Dye t...@tsdye.com Hi Riccardo, This code appears to be outdated. I don't recall this code on the org site. Could you send a URL? All the best, Tom Riccardo Romoli ric.rom...@gmail.com writes: Hi, I'm trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong? Best Riccardo Hi, I#39;m trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: mailto:your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong?BestRiccardo -- Thomas S. Dye http://www.tsdye.com
Re: [O] org-babel export latex problem
Thanks for the suggestion, the update fix the problem. Best Riccardo 2012/2/3 Thomas S. Dye t...@tsdye.com The current version is 7.8. Could you update and see if the problem persists? Tom Sent from my iPhone On Feb 3, 2012, at 1:43 AM, Riccardo Romoli ric.rom...@gmail.com wrote: The version is 6.33x Best 2012/2/3 Thomas S. Dye t...@tsdye.com Riccardo Romoli ric.rom...@gmail.com writes: Hi, I'm new of these list and of the org-babel world. I need to use both LaTeX and R, so I write the R code within an src block: #+begin_src R :results output silent :exports none library(chemometrics) library(MASS) library(lattice) #+end_src When I export to LaTex (C-c C-e l) the R code I wrote, this is the result: \begin{verbatim} library(chemometrics) library(MASS) library(lattice) \end{verbatim} How could I not display the result of the R computation? In the org- manual (chapter 14 ) I read that what I need should be done using: :results output silent :exports none but despite I use this option nothing change. Do you have any suggestion?? Best Riccardo Aloha Riccardo, What version of Org mode are you using? All the best, Tom -- Thomas S. Dye http://www.tsdye.com
[O] Generating plot with org-babel-R
Hi, I'm trying to generate some figure with R, into an org session. Firstly I use the code in the org site. The problem is that the code do not generate any figure. This is the code: #+TITLE:Test #+AUTHOR: Your Name #+EMAIL: your-em...@server.com #+BABEL: :session *R* :cache yes :results output graphics :exports both :tangle yes * Example of Org-Babel for R Literate Programming ** R text output A simple summary. #+begin_src R x - rnorm(10) summary(x) #+end_src ** R graphics output Note we use the object =x= generated in previous code block, thanks to the header option =:session *R*=. The output graphics file is =a.png=. #+begin_src R :file a.png y - rnorm(10) plot(x, y) #+end_src Same plot with larger dimension: #+begin_src R :file b.png :width 800 :height 800 plot(x, y) #+end_src Where do I wrong? Best Riccardo
Re: [O] org-babel export latex problem
The version is 6.33x Best 2012/2/3 Thomas S. Dye t...@tsdye.com Riccardo Romoli ric.rom...@gmail.com writes: Hi, I'm new of these list and of the org-babel world. I need to use both LaTeX and R, so I write the R code within an src block: #+begin_src R :results output silent :exports none library(chemometrics) library(MASS) library(lattice) #+end_src When I export to LaTex (C-c C-e l) the R code I wrote, this is the result: \begin{verbatim} library(chemometrics) library(MASS) library(lattice) \end{verbatim} How could I not display the result of the R computation? In the org- manual (chapter 14 ) I read that what I need should be done using: :results output silent :exports none but despite I use this option nothing change. Do you have any suggestion?? Best Riccardo Aloha Riccardo, What version of Org mode are you using? All the best, Tom -- Thomas S. Dye http://www.tsdye.com
[O] org-babel export latex problem
Hi, I'm new of these list and of the org-babel world. I need to use both LaTeX and R, so I write the R code within an src block: #+begin_src R :results output silent :exports none library(chemometrics) library(MASS) library(lattice) #+end_src When I export to LaTex (C-c C-e l) the R code I wrote, this is the result: \begin{verbatim} library(chemometrics) library(MASS) library(lattice) \end{verbatim} How could I not display the result of the R computation? In the org- manual (chapter 14 ) I read that what I need should be done using: :results output silent :exports none but despite I use this option nothing change. Do you have any suggestion?? Best Riccardo