[R] LaTeX consistent publication graphics from R and Comparison of GLE and R

Marc Schwartz marc_schwartz at me.com
Sat Oct 6 18:11:20 CEST 2012


Hi Frank,

I have not used tikz, so am not sure.

I have been hand coding the TeX markup in the .Rnw files to date, since each study has been somewhat different in terms of various characteristics and the sponsors, in some cases, have requested some customizations to the flow charts. That has typically been done with psmatrix constructs (http://tug.org/PSTricks/main.cgi?file=pst-node/psmatrix/psmatrix).

I have also used PSTricks, with pst-tree constructs (http://tug.org/PSTricks/main.cgi?file=pst-tree/pst-tree), to create branching trees for stratified randomization flow charts. So you have a top level with all enrolled subjects, then branches from there showing each stratification level, each box showing the sample size (using \Sexpr{}s) within each strata level. Similar concept to the matrix-like orgchart style used for disposition charts, but just a different implementation, which allows for an imbalance in the tree structure (eg. differing strata in each arm based upon various criteria, etc.).

I suppose that if one were to think about it conceptually, R's list structures would be a suitable substrate for creating an object that could be passed to a print method of sorts and generate the TeX markup during Sweave (or knitr) processing. I just have not spent the time to consider how that would be done generically enough and still allow for some of the customizations that might be encountered.

Food for thought.

Best regards,

Marc


On Oct 6, 2012, at 8:14 AM, Frank Harrell <f.harrell at vanderbilt.edu> wrote:

> Hi Marc,
> 
> It would be interesting to compare with tikz for ease of use.
> 
> As an aside I've been wishing that someone would write an R function for
> creating clinical trial disposition charts using tikz or pstricks ...
> 
> Best,
> Frank
> 
> Marc Schwartz-3 wrote
>> On Oct 5, 2012, at 3:32 PM, clangkamp <
> 
>> christian.langkamp@
> 
>> > wrote:
>> 
>>> Hi Everyone
>>> 
>>> I am at the moment preparing my thesis and am looking at producing a few
>>> Organigrams / Flow charts (unrelated to the calculations in R) as well as
>>> a
>>> range of charts (barcharts, histograms, ...) based on calculations in R. 
>>> 
>>> For the Organigrams I am looking at an Opensource package called GLE at
>>> sourceforge, which produces the text part in Latex figures which is very
>>> neat and also in the same style of the thesis, which I wrote in LaTeX. It
>>> also offers a range of graphical features, and I am quite tempted.
>>> 
>>> It also produces barcharts and histograms with the options of legends
>>> etc. I
>>> have done most of my graphs so far with R, but with Organigrams and flow
>>> charts I am at a loss (A pointer here would also be very welcome). For
>>> some
>>> charts I have used MS Visio, but it would be convenient to use just one
>>> program for graphing throughout the thesis (i.e. same colour coding
>>> etc.).
>>> 
>>> Does anybody have any experience with GLE, ideally working with it with
>>> CSV
>>> tables generated within R ? Or does there exist another way to generate
>>> 'visually LaTeX consistent' graphics within R ?
>>> 
>>> Any takers ?
>> 
>> 
>> 
>> If you are comfortable in LaTeX, I would suggest that you look at
>> PSTricks:
>> 
>>  http://tug.org/PSTricks/main.cgi
>> 
>> I use that for creating subject disposition flow charts for clinical
>> trials with Sweave. I can then use \Sexpr{}'s to fill in various
>> annotations in the boxes, etc. so that all content is programmatically
>> created in a reproducible fashion.
>> 
>> There are some examples of flow charts and tree diagrams here:
>> 
>> 
>> http://tug.org/PSTricks/main.cgi?file=pst-node/psmatrix/psmatrix#flowchart
>> 
>> and there are various other online resources for using PSTricks.
>> 
>> Keep in mind that since this is PostScript based, you need to use a latex
>> + dvips + ps2pdf sequence, rather than just pdflatex.
>> 
>> Regards,
>> 
>> Marc Schwartz




More information about the R-help mailing list