[R] How to make flowchart in R?

Marc Schwartz marc_schwartz at me.com
Mon Aug 16 20:33:38 CEST 2010


On Aug 16, 2010, at 12:59 PM, johannes rara wrote:

> I have a large dataset and I would like to make some kind of flowchart
> from this dataset. The idea is to show rowcounts from data subsets:
> 
>                  data1
>             rows= 100000
>                     |
>                    / \
>                   /   \
>      males          females,
>  rows=500000   rows=500000
>                          /\
>                         /  \
>                        /    \
>         brown hair       white hair
>         rows=25000    rows=25000
> 
> Any ideas how this can be done using R?


One approach is using Sweave along with PSTricks, specifically the pst-tree package.

More information and examples here:

  http://tug.org/PSTricks/main.cgi?file=pst-tree/pst-tree

The Indian TUG also has a pretty decent tutorial series on using PSTricks here:

  http://sarovar.org/projects/pstricks/

with Chapter 11 focusing on creating trees:

  http://sarovar.org/frs/download.php/1188/chap11.pdf


I use pst-tree (and pst-node) to create subject disposition flow charts and stratification trees for clinical studies. I create the framework for the TeX graphic and then use \Sexpr{}'s to fill in the counts, percentages, other annotation, etc. as required from the data.


HTH,

Marc Schwartz



More information about the R-help mailing list