[Rd] conditional dependencies & loading

From: Kynn Jones <kynnjo_at_gmail.com>
Date: Sat, 13 Jun 2009 16:39:31 -0400


Hi!

I'm working on a package that must convert data to and from JSON. For this, it can use either the rjson package, or preferably, the faster RJSONIO package.

I have two related questions about this.

First, how can I specify that the package depends on *either* RJSONIO *or* rjson? (I.e. both are not required.)

Second, what's the best-practice R idiom for such conditional loading? I.e. I'm looking for R's equivalent of Python's

>>> try:

...     import json
... except ImportError:
...     import simplejson as json

Thanks!

kynn

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 13 Jun 2009 - 20:51:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 13 Jun 2009 - 22:36:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive