loading packages conditionally

4 replies [Last post]
mspiegel's picture
Offline
Joined: 07/31/2009

The OpenMx repository has a work-in-progress feature that generates graphs from RAM style models. This package requires the Rgraphviz library. I don't want to add Rgraphviz as a required library. Not all users will need to make graphs, and it turns out that the Rgraphviz library can be a pain to install on Windows (you need a specific version of the Graphviz library that is hidden on their website). So this feature conditionally works if the Rgraphviz package is installed. I've added some runtime tests to zzz.R that conditionally create S4 classes that are subclasses of classes defined in the Rgraphviz package. The odd thing is that R 2.9.1 on Windows does some kind of static analysis and believes the Rgraphviz package is required. So I see a message "loading Rgraphviz" package when the OpenMx library is loaded, even when Rgraphviz is not installed. Odd behavior from R, just wanted to appraise the developers of the matter.

mspiegel's picture
Offline
Joined: 07/31/2009
Umm, nevermind. It looks

Umm, nevermind. It looks like I'll just translate our models to DOT directly. Feel free to take a look at section 2.1 of "How To Plot A Graph Using Rgraphviz" and then figure out how to plot reciprocated edges when the source and sink are identical, which seems to involve some wacky combination of S3 methods spanning across the Rgraphviz and graph packages, and a call to a C function Rgraphviz_buildEdgeList where the underlying behavior is hardwired for their purposes.

tbates's picture
Offline
Joined: 07/31/2009
dot seems a good choice Bill

dot seems a good choice

Bill has done some work on this for clustering...

http://personality-project.org/r/r.ICLUST.html

mspiegel's picture
Offline
Joined: 07/31/2009
I thought I posted this for

I thought I posted this for the graphviz-interest mailing list question: https://mailman.research.att.com/pipermail/graphviz-interest/2009q3/0064...

test.dot_.png
mspiegel's picture
Offline
Joined: 07/31/2009
Opened a graphviz bug on the

Opened a graphviz bug on the se to sw incorrect direction: http://www.graphviz.org/bugs/b1752.html