Re: [R] SWEAVE - a gentle introduction
John, One additional point that I have not seen brought up yet. If your main goal is to have all the output from an existing R script put into a single output file then you should look at the `stitch` function in the knitr package. This will take an existing R script and convert it to one of the formats that knitr can process, then processes it for you without you needing to modify the script or learn any of the markdown (LaTeX or HTML or other). You do not have a lot of control over how the output looks, but it is quick and easy. For the long run I would suggest learning to use the full power of knitr, but stitch (and the related spin function which gives a few more options) is a quick way to process an existing script. On Tue, Nov 17, 2015 at 8:21 AM, John Sorkinwrote: > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in one > document. I believe this can be accomplished with SWEAVE. Unfortunately I > don't know HTML, but am willing to learn. . . as I said I need a gentle > introduction to SWEAVE. > Thank you, > John > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:18}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
What’s more, for pdf output one can use R Markdown and judiciously sneak in html and/or LaTeX (consider however what the processing steps might do to such markup). John Maindonald email: john.maindon...@anu.edu.au<mailto:john.maindon...@anu.edu.au> On 19/11/2015, at 00:00, r-help-requ...@r-project.org<mailto:r-help-requ...@r-project.org> wrote: From: Duncan Murdoch <murdoch.dun...@gmail.com<mailto:murdoch.dun...@gmail.com>> Subject: Re: [R] SWEAVE - a gentle introduction Date: 18 November 2015 08:09:34 NZDT To: Marc Schwartz <marc_schwa...@me.com<mailto:marc_schwa...@me.com>>, John Sorkin <jsor...@grecc.umaryland.edu<mailto:jsor...@grecc.umaryland.edu>> Cc: R-help <r-help@r-project.org<mailto:r-help@r-project.org>> On 17/11/2015 10:42 AM, Marc Schwartz wrote: On Nov 17, 2015, at 9:21 AM, John Sorkin <jsor...@grecc.umaryland.edu<mailto:jsor...@grecc.umaryland.edu>> wrote: I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I need a gentle introduction to SWEAVE. Thank you, John John, A couple of initial comments. First, you will likely get some recommendations to also consider using Knitr: http://yihui.name/knitr/ which I do not use myself (I use Sweave), but to be fair, is worth considering as an alternative. He did, and I'd agree with them. I've switched to knitr for all new projects and some old ones. knitr should be thought of as Sweave version 2. Duncan Murdoch [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
As a digest reader I am late to the discussion, but let me toss in 2 further notes. 1. Three advantages of knitr over Sweave a. The book "Dynamic documents with R and knitr". It is well written; sitting down for an evening with the first half (70 pages) is a pretty good way to learn the package. The second half covers features you may or may not use over time. My only complaint about the book is that it needs a longer index; I have had several cases of "I know I read about xxx, but where was it?". But this is ameliorated by b. Good online resources: manuals, tutorials, and question/answer pairs on various lists. c. Ongoing support. Sweave is static. 2. Latex vs markdown (knitr supports both) One can choose "latex style" or "markdown style" for writing your documents. I know latex very well (I wrote my book using it) but recommend markdown to all others in my department. The latter is about 1/3 the learning curve. Markdown produces very nice output, latex goes the extra mile to produce true book quality. But one rarely needs that extra polish, and even more rarely needs it enough to justify the extra learning cost. I still use the latex form myself as it is not at all difficult to use --- once you learn it. Terry Therneau On 11/18/2015 05:00 AM, r-help-requ...@r-project.org wrote: I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I need a gentle introduction to SWEAVE. Thank you, John __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
Given that you like a gentle introduction and don't know HTML, I would recommend rmarkdown in combination with knitr. See http://rmarkdown.rstudio.com/ for a lot of information. I find knitr more flexible than sweave. Markdown syntax is much easier than HTML or latex. Best regards, Thierry Op 17-nov.-2015 16:25 schreef "John Sorkin": > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in > one document. I believe this can be accomplished with SWEAVE. Unfortunately > I don't know HTML, but am willing to learn. . . as I said I need a gentle > introduction to SWEAVE. > Thank you, > John > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:16}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
> On Nov 17, 2015, at 9:21 AM, John Sorkinwrote: > > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in one > document. I believe this can be accomplished with SWEAVE. Unfortunately I > don't know HTML, but am willing to learn. . . as I said I need a gentle > introduction to SWEAVE. > Thank you, > John > John, A couple of initial comments. First, you will likely get some recommendations to also consider using Knitr: http://yihui.name/knitr/ which I do not use myself (I use Sweave), but to be fair, is worth considering as an alternative. Second, to create stand alone documents, as opposed to web based content, you will likely want the output to be in TeX/LaTeX via Sweave, which can then become PDF based documents via the post processing of the TeX/LaTeX source. That is what I do for all of my analytic deliverables. You can also use LaTeX classes like 'Beamer' to create Powerpoint-like slides for presentation. Fritz' web site for Sweave is here: http://www.statistik.lmu.de/~leisch/Sweave/ and there are some links to supporting materials there with very basic examples. Another resource is: https://beckmw.files.wordpress.com/2014/02/sweave_intro1.pdf and if you Google for Sweave Introductions and Tutorials, there are a myriad of others. In conjunction with Sweave itself, there are a variety of supporting packages on CRAN that have related functionality (e.g. formatted LaTeX output) that are worth knowing about and are included in the Reproducible Research task view: https://cran.r-project.org/web/views/ReproducibleResearch.html Regards, Marc Schwartz __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
I suggest using knitr instead of sweave. There are plenty of tutorials online; http://jeromyanglim.blogspot.co.nz/2012/05/getting-started-with-r-markdown-knitr.html?m=1 might be a good place to start. Links to a full length book and other resources are available at http://yihui.name/knitr/ Best, Ista On Nov 17, 2015 10:23 AM, "John Sorkin"wrote: > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in > one document. I believe this can be accomplished with SWEAVE. Unfortunately > I don't know HTML, but am willing to learn. . . as I said I need a gentle > introduction to SWEAVE. > Thank you, > John > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:16}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I need a gentle introduction to SWEAVE. Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
I've been very pleased using knitr in combination with LyX for pdf production. John Kane Kingston ON Canada > -Original Message- > From: jsor...@grecc.umaryland.edu > Sent: Tue, 17 Nov 2015 10:21:15 -0500 > To: r-help@r-project.org > Subject: [R] SWEAVE - a gentle introduction > > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in > one document. I believe this can be accomplished with SWEAVE. > Unfortunately I don't know HTML, but am willing to learn. . . as I said I > need a gentle introduction to SWEAVE. > Thank you, > John > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:17}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
When choosing source format, it's probably helpful to know that if you work with a Markdown-based format (e.g. Rmarkdown) you'll be able to generate either/both HTML or/and PDF documents, whereas if you work with LaTeX-based formats (e.g. Sweave/knitr) you will only be able output PDF documents (at least without great efforts). One major advantage with HTML documents/reports is that they aren't constrained by page breaks, e.g. you don't have to worry about generating long tables that run across two or more pages. With LaTeX that is often a great pain. These days even mathematical equations renders quite well in HTML. I tend to use HTML output for everyday analysis reports and PDF occasionally for more final artifacts such as supplementary notes where I want to have full control of layout, equations, figure sizes and bibliographies. If you plan to write package vignettes using one of the above formats, choice of vignette format does not matter these days. They're all equally easy to use and incorporate in packages. Cheers, Henrik On Tue, Nov 17, 2015 at 11:09 AM, Duncan Murdochwrote: > On 17/11/2015 10:42 AM, Marc Schwartz wrote: >> >> >>> On Nov 17, 2015, at 9:21 AM, John Sorkin >>> wrote: >>> >>> I am looking for a gentle introduction to SWEAVE, and would appreciate >>> recommendations. >>> I have an R program that I want to run and have the output and plots in >>> one document. I believe this can be accomplished with SWEAVE. Unfortunately >>> I don't know HTML, but am willing to learn. . . as I said I need a gentle >>> introduction to SWEAVE. >>> Thank you, >>> John >>> >> >> >> John, >> >> A couple of initial comments. >> >> First, you will likely get some recommendations to also consider using >> Knitr: >> >>http://yihui.name/knitr/ >> >> which I do not use myself (I use Sweave), but to be fair, is worth >> considering as an alternative. > > > He did, and I'd agree with them. I've switched to knitr for all new > projects and some old ones. knitr should be thought of as Sweave version 2. > > Duncan Murdoch > > >> >> Second, to create stand alone documents, as opposed to web based content, >> you will likely want the output to be in TeX/LaTeX via Sweave, which can >> then become PDF based documents via the post processing of the TeX/LaTeX >> source. That is what I do for all of my analytic deliverables. You can also >> use LaTeX classes like 'Beamer' to create Powerpoint-like slides for >> presentation. >> >> Fritz' web site for Sweave is here: >> >>http://www.statistik.lmu.de/~leisch/Sweave/ >> >> and there are some links to supporting materials there with very basic >> examples. >> >> Another resource is: >> >>https://beckmw.files.wordpress.com/2014/02/sweave_intro1.pdf >> >> and if you Google for Sweave Introductions and Tutorials, there are a >> myriad of others. >> >> In conjunction with Sweave itself, there are a variety of supporting >> packages on CRAN that have related functionality (e.g. formatted LaTeX >> output) that are worth knowing about and are included in the Reproducible >> Research task view: >> >>https://cran.r-project.org/web/views/ReproducibleResearch.html >> >> Regards, >> >> Marc Schwartz >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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 -- To UNSUBSCRIBE and more, see > 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 -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
On 17/11/2015 6:56 PM, Henrik Bengtsson wrote: When choosing source format, it's probably helpful to know that if you work with a Markdown-based format (e.g. Rmarkdown) you'll be able to generate either/both HTML or/and PDF documents, whereas if you work with LaTeX-based formats (e.g. Sweave/knitr) you will only be able output PDF documents (at least without great efforts). One major advantage with HTML documents/reports is that they aren't constrained by page breaks, e.g. you don't have to worry about generating long tables that run across two or more pages. With LaTeX that is often a great pain. These days even mathematical equations renders quite well in HTML. I tend to use HTML output for everyday analysis reports and PDF occasionally for more final artifacts such as supplementary notes where I want to have full control of layout, equations, figure sizes and bibliographies. If you plan to write package vignettes using one of the above formats, choice of vignette format does not matter these days. They're all equally easy to use and incorporate in packages. Yes, I agree with everything you say. One additional thing: I've been working on the rgl package lately (for movable 3D graphics); it is possible to embed those in a PDF document, but not portably (i.e. the PDF viewer will matter); it is much easier to embed rgl graphics in HTML. So I tend to use Markdown input through knitr (which calls Rmarkdown). Duncan Murdoch Cheers, Henrik On Tue, Nov 17, 2015 at 11:09 AM, Duncan Murdochwrote: On 17/11/2015 10:42 AM, Marc Schwartz wrote: On Nov 17, 2015, at 9:21 AM, John Sorkin wrote: I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I need a gentle introduction to SWEAVE. Thank you, John John, A couple of initial comments. First, you will likely get some recommendations to also consider using Knitr: http://yihui.name/knitr/ which I do not use myself (I use Sweave), but to be fair, is worth considering as an alternative. He did, and I'd agree with them. I've switched to knitr for all new projects and some old ones. knitr should be thought of as Sweave version 2. Duncan Murdoch Second, to create stand alone documents, as opposed to web based content, you will likely want the output to be in TeX/LaTeX via Sweave, which can then become PDF based documents via the post processing of the TeX/LaTeX source. That is what I do for all of my analytic deliverables. You can also use LaTeX classes like 'Beamer' to create Powerpoint-like slides for presentation. Fritz' web site for Sweave is here: http://www.statistik.lmu.de/~leisch/Sweave/ and there are some links to supporting materials there with very basic examples. Another resource is: https://beckmw.files.wordpress.com/2014/02/sweave_intro1.pdf and if you Google for Sweave Introductions and Tutorials, there are a myriad of others. In conjunction with Sweave itself, there are a variety of supporting packages on CRAN that have related functionality (e.g. formatted LaTeX output) that are worth knowing about and are included in the Reproducible Research task view: https://cran.r-project.org/web/views/ReproducibleResearch.html Regards, Marc Schwartz __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] SWEAVE - a gentle introduction
On 17/11/2015 10:42 AM, Marc Schwartz wrote: On Nov 17, 2015, at 9:21 AM, John Sorkinwrote: I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I need a gentle introduction to SWEAVE. Thank you, John John, A couple of initial comments. First, you will likely get some recommendations to also consider using Knitr: http://yihui.name/knitr/ which I do not use myself (I use Sweave), but to be fair, is worth considering as an alternative. He did, and I'd agree with them. I've switched to knitr for all new projects and some old ones. knitr should be thought of as Sweave version 2. Duncan Murdoch Second, to create stand alone documents, as opposed to web based content, you will likely want the output to be in TeX/LaTeX via Sweave, which can then become PDF based documents via the post processing of the TeX/LaTeX source. That is what I do for all of my analytic deliverables. You can also use LaTeX classes like 'Beamer' to create Powerpoint-like slides for presentation. Fritz' web site for Sweave is here: http://www.statistik.lmu.de/~leisch/Sweave/ and there are some links to supporting materials there with very basic examples. Another resource is: https://beckmw.files.wordpress.com/2014/02/sweave_intro1.pdf and if you Google for Sweave Introductions and Tutorials, there are a myriad of others. In conjunction with Sweave itself, there are a variety of supporting packages on CRAN that have related functionality (e.g. formatted LaTeX output) that are worth knowing about and are included in the Reproducible Research task view: https://cran.r-project.org/web/views/ReproducibleResearch.html Regards, Marc Schwartz __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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.