Hello Everyone, Been learning R over the past several months. Read several books and have learned a great deal about data manipulation, statistical analysis, and graphics. Now I want to learn how to make nice looking documents and about "literate programming." My understanding is that R users normally do this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave. An alternative might be to use the R2wd package to create Word documents. So I guess I have four questions: 1. How do I choose between the various options? Why would someone decide to use LaTeX instead of MiKTeX or vice versa for example? 2. What are the best sources of information about LaTeX, MiKTeX, LyX, etc.? 3. What is the learning curve like for each of these? What do you get for the time you put in learning something that is more difficult? 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents with people who are just using Word? How difficult does using LaTeX, MiKTeX, LyX, etc. make it to collaborate on projects with others? Thanks, Paul [[alternative HTML version deleted]]
For the GUI-addicted people (partly including me), I think LyX + Sweave is an excellent choice. LyX is based on LaTeX; it can do almost anything that LaTeX can do, and it takes care of a lot of details when compiling a LaTeX document. The solution for embedding Sweave in LyX has been there for a long time, and recently I tried to automate the configuration so that beginners can hopefully get into this fantastic world more quickly. See the video in this post: http://yihui.name/en/2010/10/how-to-start-using-pgfsweave-in-lyx-in-one-minute/ (I recommend pgfSweave instead of Sweave, though.) I did not answer your questions directly, but the video might give you an idea how easy it looks (well, only "looks" easy -- learning Sweave is unavoidable). Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Tue, Dec 7, 2010 at 5:29 PM, Paul Miller <pjmiller_57 at yahoo.com> wrote:> Hello Everyone, > > Been learning R over the past several months. Read several books and have learned a great deal about data manipulation, statistical analysis, and graphics. > > Now I want to learn how to make nice looking documents and?about "literate programming." My understanding is that R users normally do this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave.?An alternative might be to use the R2wd package to create Word documents. > > So I guess I have?four questions: > > 1. How do I choose between the various options? Why would someone decide to use LaTeX instead of MiKTeX or vice versa for example? > > 2. What are the best sources of information about LaTeX, MiKTeX, LyX, etc.? > > 3. What is the learning curve like for each of these? What do you get?for the time you put in learning something that is more difficult? > > 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents with people who are just using Word? How difficult does using LaTeX, MiKTeX, LyX, etc. make it to collaborate on projects with others? > > Thanks, > > Paul > > > ? ? ? ?[[alternative HTML version deleted]] > > > ______________________________________________ > R-help at 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. > >
See inline below> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Paul Miller > Sent: Tuesday, December 07, 2010 4:29 PM > To: r-help at r-project.org > Subject: [R] LaTeX, MiKTeX, LyX: A Guide for the Perplexed > > Hello Everyone, > > Been learning R over the past several months. Read several books and > have learned a great deal about data manipulation, statistical > analysis, and graphics. > > Now I want to learn how to make nice looking documents and?about > "literate programming." My understanding is that R users normally do > this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave.?An > alternative might be to use the R2wd package to create Word documents. > > So I guess I have?four questions: > > 1. How do I choose between the various options? Why would someone > decide to use LaTeX instead of MiKTeX or vice versa for example?MikTeX is a flavor of LaTeX for windows, so there is not much to decide between them, MikTeX is LaTeX (though there are other implementations on windows)> > 2. What are the best sources of information about LaTeX, MiKTeX, LyX, > etc.?There are many documents about LaTeX, including books. But I would suggest starting with the "Not So Short Introduction to LaTeX" that is free and comes with MikTeX (and probably the others). LyX should have its own docs with it. There are several other guides that come free that would be good to read after that. If you want a paper book then I would suggest the original by Lamport.> 3. What is the learning curve like for each of these? What do you > get?for the time you put in learning something that is more difficult?That depends on your background, if you have never worked from the command line or with a markup language, then it is pretty steep, if you have worked with those types of tools then it is not as bad. But either way it is worth it. When I first learned LaTeX I was tempted to go back and rewrite my master's thesis in it instead of the word processor. I did not, but my dissertation was in LaTeX.> 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents with > people who are just using Word? How difficult does using LaTeX, MiKTeX, > LyX, etc. make it to collaborate on projects with others?Sharing LaTeX documents with people using word processors only is no more difficult than giving driving directions to someone who is blindfolded and has all 4 limbs tied behind their back. Collaboration with people who insist on using programs that process their words much like a food processor processes food is the one legitimate reason to not use LaTeX (but untying them and removing the blindfold is much better). If you just need basic input or approval then give them a paper version or pdf file and then you make the changes. If they are going to be writing major portions or doing a lot of editing, then using LaTeX without all people understanding it will be a headache. Some other packages to consider are odfWeave (odf is the opensource office suite, it can read and write MSWord documents, but still sweave with R); R2HTML works with sweave where the base document is in html; sword is a tool from the same group as rexcel that gives the same general idea as sweave but using MSWord (windows only).> Thanks, > > Paul >-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111
On 12/07/2010 05:29 PM, Paul Miller wrote:> Hello Everyone, > > Been learning R over the past several months. Read several books and have > learned a great deal about data manipulation, statistical analysis, and > graphics. > > Now I want to learn how to make nice looking documents and about "literate > programming." My understanding is that R users normally do this using LaTeX, > MiKTeX, LyX, etc. in conjuction with Sweave. An alternative might be to use > the R2wd package to create Word documents.Yes, the advantage of these methods being you can "re-execute" the source document to generate a new deliverable each time the data change or a slightly different analysis is requested. Say you're writing a report or manuscript that contains the typical "Results" section. You will have dozens of summary statistics scattered throughout the section and in tables and figures. Now, the PI finds 5 more subjects, and wants a new manuscript. You just have to perform one command to use the new data and generate the new document. Let the computer do the computing.> So I guess I have four questions: > > 1. How do I choose between the various options? Why would someone decide to > use LaTeX instead of MiKTeX or vice versa for example?I am not a LaTeX expert, but as far as I know, MiKTeX is just one of many LaTeX distributions, i.e., MiKTeX *is* LaTeX in a sense. If you're on Windows, I think MiKTeX is the most popular distribution. I suppose technically LaTeX is just a set of macros for TeX. Distributions like MiKTeX package together those macros and hundreds of add-on packages that make it easier to do neat things with your documents. The upshot: if you're using Windows, use MiKTeX.> 2. What are the best sources of information about LaTeX, MiKTeX, LyX, etc.?I have found that books are. What you really need to learn is about LaTeX, not MiKTex per se. So, there are many online tutorials and guides for using LaTeX, http://www.latex-project.org/guides/ Also, books: http://www.latex-project.org/guides/books.html I have the 2nd book on this list (The LaTeX Companion). I've found it most useful after having learned the basics. It basically shows you the capabilities of hundreds of the add-on packages. I can't comment on Leslie Lamport's book, but he is the creator of LaTeX. The best way is to jump in and start using it, and ask questions when you hit a wall!> 3. What is the learning curve like for each of these? What do you get for the > time you put in learning something that is more difficult?It's *not* a bad learning curve at all, that's part of the point of using it. You can create beautiful looking documents by using markup to describe what you want the document to look like. True, it's a far departure from the Work-and-friends toolset. However, here's what makes it easy: 1) It's just plain text: no wondering what strange characters and hidden features you've introduced into a document. 2) Markup: Now that HTML has been around forever, everyone knows what markup documents consist of. LaTeX is just a different markup tool. 3) Editors: There are plenty of editors (including Lyx which I've never used) to help with LaTeX. Emacs is another popular one for those interested in Sweave. This is because Emacs can run R inside of it, and has special syntax highlighting for not only R and LaTeX files, but also for Sweave files. What you get for investing the time is an explosion in productivity that will happen after you master a simple workflow. The concentrate on data management and content, not fretting over whether every number got copied and pasted correctly. You can make a single change to one variable (say, the date of data transfer) and have a completely new report with hundreds of tables and figures generated in seconds.> 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents with people > who are just using Word? How difficult does using LaTeX, MiKTeX, LyX, etc. > make it to collaborate on projects with others?If you're writing a collaborative paper with someone who uses Word, and only Word, I don't know how you'd make that work. There are certainly no canned solutions that I know of. What I tend to do is write my statistical reports in Sweave so that a PDF can be automatically generated when new data arrive. These reports contain all tables and figures, modeling results, etc., that the PI would want. I then leave it to them to include the statistics that they want to when they write the paper in Word. Ideal, no. If you can show colleagues the advantages of the techniques, they may buy in to the workflow, and you can use simple version control (say, git) to track changes over time and independently work on a manuscript. This would of course require the appropriate level of 'technical expertise' on the part of your co-author(s). As a final note, if you do end up with this work flow, and have any interest at all in Emacs, you should definitely check out the org-mode project, at http://orgmode.org . Org-mode will let you write content and embed code in dozens of languages, including R, that can be exported to PDF, HTML, DocBook, and others all simultaneously. It is thus an alternative to Sweave, although conceptually similar. Org-mode can also be used as a note-taking tool, project planner, calendar, ... It is by for the most important tool I've discovered since R. --Erik
Hi Paul, I am using Sweave and MiKTeX and the results are really impressive, but it's often quite complicated (or impossible) to share the rnw-files with my colleagues/clients. So it depends with/for whom you are working. Perhaps as an alternative you could use a simpler markup format e.g. "Markdown" (with the "ascii" package). To convert between different markup languages Pandoc [1] looks very promising. HTH Patrick [1] http://johnmacfarlane.net/pandoc Am 08.12.2010 00:29, schrieb Paul Miller:> Hello Everyone, > ? > Been learning R over the past several months. Read several books and have learned a great deal about data manipulation, statistical analysis, and graphics. > ? > Now I want to learn how to make nice looking documents and?about "literate programming." My understanding is that R users normally do this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave.?An alternative might be to use the R2wd package to create Word documents. > ? > So I guess I have?four questions: > ? > 1. How do I choose between the various options? Why would someone decide to use LaTeX instead of MiKTeX or vice versa for example? > ? > 2. What are the best sources of information about LaTeX, MiKTeX, LyX, etc.? > ? > 3. What is the learning curve like for each of these? What do you get?for the time you put in learning something that is more difficult? > ? > 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents with people who are just using Word? How difficult does using LaTeX, MiKTeX, LyX, etc. make it to collaborate on projects with others? > ? > Thanks, > ? > Paul > > > [[alternative HTML version deleted]] > > > > > ______________________________________________ > R-help at 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.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/08/2010 12:29 AM, Paul Miller wrote:> Hello Everyone,Hi Paul,> > Been learning R over the past several months. Read several books and > have learned a great deal about data manipulation, statistical > analysis, and graphics. > > Now I want to learn how to make nice looking documents and about > "literate programming." My understanding is that R users normally do > this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave. An > alternative might be to use the R2wd package to create Word > documents.Different option to sweave: I am using org-mode in emacs. You have to get used to emacs, but then you have huge advantages (probably over sweave as well): 1) in emacs, you use ESS, the most useful R editor (personal opinion - no war vim versus emacs versus rkward versus ... intended) 2) your document, as in sweave, can be exported to LaTeX, but also to html and other formats 3) as in sweave, you can tangle your code, but not only that: org-mode (or more accurate the included org-babel) allows you to combine different programming language in your document (e.g. http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/data-collection-analysis.org which combines ruby, R and gnuplot) last but not least, 4) org mode, apart from its use for literate programming, is a task manager, time manager, ... . Therefore you can easily include TODO items in your document, selectively show your all TODO items, kepp track of your time you spend on certain projects (usefull for consultancies but also simply to keep track what you are doing). Finally: it is no as difficult as it sounds, as you only have to know about the literate programming with org-babel, and then you can start. The rest will follow. Here is a link which gives an introduction to R in org-babel: http://blogisticreflections.wordpress.com/2010/05/23/introduction-to-using-r-with-org-babel-part-1/ and also http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.php See also http://orgmode.org/worg/org-contrib/babel/uses.php for a comparison between sweave and org-mode / org-babel. - From personal experience, org-mode has dramatically changed (and improved) the way I use R and how I write code (long simulation models). Cheers, Rainer> > So I guess I have four questions: > > 1. How do I choose between the various options? Why would someone > decide to use LaTeX instead of MiKTeX or vice versa for example? > > 2. What are the best sources of information about LaTeX, MiKTeX, LyX, > etc.? > > 3. What is the learning curve like for each of these? What do you get > for the time you put in learning something that is more difficult? > > 4. How do people who use LaTeX, MiKTeX, LyX, etc. share documents > with people who are just using Word? How difficult does using LaTeX, > MiKTeX, LyX, etc. make it to collaborate on projects with others? > > Thanks, > > Paul > > > [[alternative HTML version deleted]] > > > > > ______________________________________________ R-help at 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.- -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel: +33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: Rainer at krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkz/TqQACgkQoYgNqgF2egpPTwCfeDJrzhGI2U5nTM9N15QnCL/h k28An1XAw0nq1LTEgUwC0WaMSCM3lzt7 =OR5g -----END PGP SIGNATURE-----