[Bioc-devel] Install subset of R package

Seth Falcon sfalcon at fhcrc.org
Sun Jan 7 03:23:38 CET 2007


"Oliver Bembom" <bembom at gmail.com> writes:

> Hi all,
>
> Does anybody know of a way to install only a subset of an R package? An R
> package that I've written contains a GUI part that depends on tcl/tk, and
> some users would like to able to install the package on systems without
> tcl/tk support. Since the package can be used fine without the GUI, I was
> thinking that I could just remove the GUI part from the package and move it
> into a separate add-on package. 

Separating the package into two parts is a very reasonable solution
and is probably the best option.

> Alternatively, is there a way to offer an option that would allow
> the user to decide at install time to not install the GUI part? All
> the functions for the GUI are in a separate .R file; only one of the
> GUI functions is exported in the NAMESPACE and is called at only one
> point in the remainder of the package.

It isn't clear that install time is when you want to make the choice.
Why force a reinstall if you don't have to?

One other option, which will also become tedious or impossible
depending on the complexity of the code is:

   * Put tcl/tk in Suggests

   * In .onLoad, attempt to load tcltk using require and store the
     result in an environment in your package's name space.  Then you
     can have conditional code based on whether or not tcltk is
     available.

The pkgDepTools package takes this approach in making optional
functionality from the RCurl package.  So that is a place to look.
Mostly this works great, but I'm fairly certain that once you start
trying to deal with S4 classes and methods in this way, things will
break down.

+ seth



More information about the Bioc-devel mailing list