[R] From R to LaTeX to pdf?
Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} The output from xtable (above) is not a self-contained, complete LaTeX file. You need, at the very least, A \documentclass statement at the beginning of the file and the code above needs to be inside a \begin{document} ... \end{document} pair. Then, the pdflatex (I beilieve this exists in MiKTeX) command builds a pdf file. Kevin Best regards, Joel -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Hi Joel, that's a LaTeX issue you have there, nothing wrong with R. You should post your message on a LaTeX Forum about how to use LaTeX. http://www.latex-community.org/ Regards Benoit -Message d'origine- De : r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] De la part de Joel Fürstenberg-Hägg Envoyé : mardi 24 novembre 2009 15:02 À : r-help@r-project.org Objet : [R] From R to LaTeX to pdf? Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton pe Skydrive. Det dr enkelt och sdkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Joel, You should consider using Sweave: http://www.stat.umn.edu/~charlie/Sweave/ -or- http://en.wikipedia.org/wiki/Sweave Regards, Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Thomas E Adams National Weather Service Ohio River Forecast Center 1901 South State Route 134 Wilmington, OH 45177 EMAIL: thomas.ad...@noaa.gov VOICE: 937-383-0528 FAX:937-383-0033 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
2009/11/24 Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. You could also have a look at the latex function in the Hmisc package S [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Hello On 11/24/09, Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com wrote: I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Take a look at the documentation of RcmdrPlugin.Export. Regards Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
2009/11/24 Tom Backer Johnsen bac...@psych.uib.no: As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. I actually find that Hmisc::latex generates tables pretty much exactly as I want them. For me, this is one of the greatest strengths of R (well, R + LaTeX = Sweave actually). -Ista Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
While what you say is true for base R, someone already mentioned Hmisc's latex function, and I have written several custom functions to output tables in LaTeX, the benefit being the elimination of manual formatting and intervention when preparing tables. Add this in with Sweave and make files, and you have a chain where you can drop in a new dataset, type make, and have a brand new report with no manual intervention. Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Backer Johnsen Sent: Tuesday, November 24, 2009 9:06 AM To: Joel Fürstenberg-Hägg Cc: r-help@r-project.org Subject: Re: [R] From R to LaTeX to pdf? As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
I am sure you are right. I myself have not looked at the LaTeX function in Hmisc, that really sounds interesting, and thank you. On the other hand I had the impression (which may be wrong) that the original question was posed by someone with not too much experience. If that is the case the suggestion to combine custom functions in R with Sweave might be overwhelming at the very least. My alternative was definitely much less elegant, but would work for someone with less experience. I use R in my courses, but allow my students to use other packages. I am nevertheless always surprised at how many prefer R. In any case, I tell students how to transfer results from any statistical program into MS Word which most prefer. Since my field is psychology, the important standard is APA, which is quite complicated. In that situation, you really have to transfer things via a spreadsheet. You would be stupid not to, especially in respect to SPSS. Tom Erik Iverson wrote: While what you say is true for base R, someone already mentioned Hmisc's latex function, and I have written several custom functions to output tables in LaTeX, the benefit being the elimination of manual formatting and intervention when preparing tables. Add this in with Sweave and make files, and you have a chain where you can drop in a new dataset, type make, and have a brand new report with no manual intervention. Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Backer Johnsen Sent: Tuesday, November 24, 2009 9:06 AM To: Joel Fürstenberg-Hägg Cc: r-help@r-project.org Subject: Re: [R] From R to LaTeX to pdf? As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Doesn't the APA package in LaTeX help in this situation? --Chris Ryan Original message Date: Tue, 24 Nov 2009 18:24:52 +0100 From: Tom Backer Johnsen bac...@psych.uib.no Subject: Re: [R] From R to LaTeX to pdf? To: Erik Iverson eiver...@nmdp.org Cc: r-help@r-project.org r-help@r-project.org, Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com I am sure you are right. I myself have not looked at the LaTeX function in Hmisc, that really sounds interesting, and thank you. On the other hand I had the impression (which may be wrong) that the original question was posed by someone with not too much experience. If that is the case the suggestion to combine custom functions in R with Sweave might be overwhelming at the very least. My alternative was definitely much less elegant, but would work for someone with less experience. I use R in my courses, but allow my students to use other packages. I am nevertheless always surprised at how many prefer R. In any case, I tell students how to transfer results from any statistical program into MS Word which most prefer. Since my field is psychology, the important standard is APA, which is quite complicated. In that situation, you really have to transfer things via a spreadsheet. You would be stupid not to, especially in respect to SPSS. Tom Erik Iverson wrote: While what you say is true for base R, someone already mentioned Hmisc's latex function, and I have written several custom functions to output tables in LaTeX, the benefit being the elimination of manual formatting and intervention when preparing tables. Add this in with Sweave and make files, and you have a chain where you can drop in a new dataset, type make, and have a brand new report with no manual intervention. Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Backer Johnsen Sent: Tuesday, November 24, 2009 9:06 AM To: Joel Fürstenberg-Hägg Cc: r-help@r-project.org Subject: Re: [R] From R to LaTeX to pdf? As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\ \hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] From R to LaTeX to pdf?
Tom Backer Johnsen wrote: As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML library is useful for that operation. When things are the way you want it, transfer it to LaTex via a text file, e.g. .csv. Tom Tom, I'll take friendly exception with that recommendation, which is error-prone and is not consistent with reproducible research practice. To see some of the power of the R-LaTeX approach see http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf That document was also converted to Word using pdftoword.com with the result available at http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.zip Frank Joel Fürstenberg-Hägg wrote: Hi all, Anyone experienced in the LaTeX format? I'm trying to use the xtable package to create nice anova tables, but how do I do to produce a pdf from the resulting LaTeX table? I've tried WinShell and MiKTeX, but I couldn't get any of them working... Here's an example of the output in R: % latex table generated in R 2.9.2 by xtable 1.5-6 package % Tue Nov 24 14:17:32 2009 \begin{tabular}{lr} \hline Df Sum Sq Mean Sq F value Pr($$F) \\ \hline cat 2 40.50 20.25 6.66 0.0019 \\ Residuals 107 325.13 3.04 \\\hline \end{tabular} Best regards, Joel _ Lagra alla dina foton på Skydrive. Det är enkelt och säkert! http://www.skydrive.live.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.