Rreport/LaTeX quality output package - r

I'm looking for some LaTeX template for creating quality output. On R-bloggers I've bumped on Frank Harrel's Rreport package. Due to my quite modest LaTeX abilities, only a user-friendly (and noob-friendly) interface should suffice. Here's a link to an official website. I'm following the instructions, but I cannot manage to install an app. I use Ubuntu 9.10, R version is 2.10.1 (updated regularly from UCLA's CRAN server), and of course, cvs is installed on my system.
Now, I'd like to know if there is some user-friendly LaTeX template package (Sweave is still to advanced/spartan for me). I'm aware that my question is quite confounding, but a brief glance on examples on Rreport page should give you a hint. I'm aware that LaTeX skills are a must, but just for now I need something that will suit my needs (as a psychological researcher).
Is there any package similar with Rreport?

lyx? http://www.lyx.org/
On Ubuntu:
sudo apt-get install lyx
From the lyx page:
LyX combines the power and flexibility
of TeX/LaTeX with the ease of use of a
graphical interface. This results in
world-class support for creation of
mathematical content (via a fully
integrated equation editor) and
structured documents like academic
articles, theses, and books.

If you want to produce Latex with a simpler markup you could use the ASCII package that has a Sweave driver that can be used with reSTructured text, which can then be converted to Latex. Although I would only use it if you want to be able to convert the same doc also to html or odf. In any case it is a good idea to learn the basic Latex.

The online text processor zoho allows export to latex. Maybe this can be helpful to learn latex, but I do not know how to integrate Sweave/R in this. (I did not work with zoho, by the way).

Related

How does the knitr language engine for Python in RMarkdown keep track of variables across code chunks?

I was looking at the source code of knitr in order to better understand how the language engines work, and it seems that evaluating code in a single chunk is a relatively simple matter, but what I have trouble understanding is how it is possible for the Python chunks to call the variables across chunks. I get the impression from earlier packages by Yihui that attempts were made to do this with sockets, but it seems that the current code for both reticulate and knitr does not contain code for sockets, hence my question.
This is done through the reticulate package instead of runr. You may see Section 2.7.1 of the R Markdown Definitive Guide for details.
P.S. runr was a very early experiment and never officially used in knitr.

Can Roxygen really document R script (not a package) just like Doxygen does for C++?

Roxygen is inspired by the Doxygen documentation system that is used by C, C++ programmers. I have used Doxygen and I find it really easy to document any program as long as you have the doxygen comment. It also generate call graphs for functions and classes. I thought roxygen would work the same way but when I search for roxygen help, I only find solution to documenting R packages.
I have checked Hadley Wickham's online roxygen2 help but that does not describe anything about the R script documentation.
My scripts sometimes become 500-1000 lines and have several functions which I always document with the comments. I want to generate PDF or HTML documentation with graph-viz diagrams. Is Roxygen capable of making call-graph and document standalone R scripts?
No, roxygen2 will work only for writing package documentation. Sounds to me you're after a report generating tool. You can use knitr for that. You can include code, comments, text, MathJax, or even use LaTeX. It also supports table of contents and references. This is by no means an exhaustive list of functionality. With some logical limitations, you can produce pdf and html documents, among others.
Though this is an old thread, for future reference, the following library is able to achieve that:
https://rdrr.io/cran/document/
From its docs: Have you ever been tempted to create 'roxygen2'-style documentation comments for one of your functions that was not part of one of your packages (yet)? This is exactly what this package is about: running 'roxygen2' on (chunks of) a single code file.

R Programming brew vs. Sweave-- suppressing output and brew limitations

I am a newbie to the R world-- a couple of weeks. I have been tasked to automate the generation of a database codebook. The thought was to use R, LaTex, and Sweave as a solution. Because of the repetitive nature of the codebook tables and the use of looping over code chunks, Sweave may not be a viable means. It looks like the brew package could be an alternative. As I have been doing some testing with brew, I'm running into an issue with loading in the RMySQL package (via library(RMySQL)) as I cannot suppress the output--
Looking in C:Files/MySQL, C:/MySQL, D:/MySQL, E:/MySQL, F:/MySQL,
G:/MySQL, C:/xampp/MySQL, D:/xampp/MySQL, E:/xampp/MySQL, F:/xampp/MySQL,
G:/xampp/MySQL, C:/Apps/MySQL, D:/Apps/MySQL, E:/Apps/MySQL, F:/Apps/MySQL,
G:/Apps/MySQL Found C:Files/MySQL
I have tried to set the Library function arguments verbose=TRUE and quietly=TRUE but that did not work. In Sweave, I am able to suppress by setting the code chunk option to results=hide. Is there any alternative to suppress this output information when using brew?
In determining whether or not brew is a good solution for the codebook generation, should I be aware of any limitations of brew as compared to Sweave?
To supress messages during loading of a library:
suppressMessages(library(RMySQL))
Also, definitely take a look at the knitr package. It roughly does what Sweave does, but then better. It supports caching of objects (which kept me from heavily using Sweave), and much more flexibility. Take a look at the website, or on a blogpost of mine showing a simple example of a presentation in Latex made using knitr and beamer.

Embedding scripts in text-editor

I am looking for a text editor that support embedding scripts (Perl in my case) in the text you write.
I understand that something like it is possible through Emacs, but am not sure how and what.
The idea is to generate reports that contain the output of the embedded scripts, which are run while generating the report (if not already in previous versions of the report).
The Babel package in Emacs can do this. See the introductory tutorial here.
sweave does that in a limited way (R only).

How do I generate reports in R without texi2dvi or TeX installed?

I've been struggling for a week now trying to figure out how to generate reports in R using either Sweave or Brew. I should say right at the beginning that I have never used Tex before but I understand the logic of it.
I have read this document several times. However, I cannot even get a simple example to parse. Brew successfully converts a simple markup file (just a title and some text) to a .tex file (no error). But it never ever converts tex to a pdf.
> library(tools)
> library(brew)
> brew("population.brew", "population.tex")
> texi2dvi("population.tex", pdf = TRUE)
The last step always fails with:
Error in texi2dvi("population.tex", pdf = TRUE) :
Running 'texi2dvi' on 'population.tex' failed.
What am I doing wrong?
The report I am trying to build is fairly simple. I have 157 different analysis to summarize. Each one has 4 plots, 1 table and a summary. I just want
output plot 1,2,3,4
output table
\pagebreak
...
that's it. Can anyone help me get further? I use osx, don't have Tex installed.
thanks
You cannot run this without texi2dvi or TeX installed.
An alternative may be html output -- the hwriter package is useful for that.
That said, if you want to produce pdf out, Sweave is the way to go. Frank Harrell's site has a lot of useful info but all this requires a bit of familiarity with LaTeX so you may need to install and learn that first.
If you are on OSX, might as well install the full tex live
http://mirror.ctan.org/systems/mac/mactex/MacTeX.mpkg.zip
It is a big download, but it will be nice to never have to install additional packages.
Another solution: the ascii package in conjonction to your favorite markup language (asciidoc, txt2tags, restructuredtext, org or textile).
http://eusebe.github.com/ascii/
It may be worthwhile spending a week or so just using LaTeX without R and going through a bunch of introductory LaTeX tutorials.
Thus, when you start producing Sweave or Brew documents and you get errors, you will be better able to identify whether the error is arising from LaTeX or Sweave / Brew.
A couple of Windows tools that make it easy to get started with LaTeX include MikTeX + TeXnicCenter or MikTeX + WinEdt.
Another solution is to try a solution of connecting R to microsoft.
It is much weaker then Sweave, but for basic reporting might be what you need.
You might want to go through the example sessions given here: Exporting R output to MS-Word with R2wd (an example session)
I've also been hearing a lot of good things about the knitr package. It seems to resemble Sweave a lot, but add some more to it. I would definitely take a look at it.

Resources