[R-pkg-devel] how to make "r-release-osx-x86_64-mavericks" machine support rgl 3D plots

Dr Gregory Jefferis jefferis at mrc-lmb.cam.ac.uk
Thu Dec 31 13:47:37 CET 2015

Dear Duncan,

On 31 Dec 2015, at 0:28, Duncan Murdoch wrote:

> On 30/12/2015 4:42 PM, Dr Gregory Jefferis wrote:
>> On 30 Dec 2015, at 21:11, Duncan Murdoch wrote:

>> I wasn't being clear there. I want to have rgl example code (e.g. 
>> plot3d
>> statements) in my documentation
>> * that's not enclosed in conditionals
>> * or \dontrun
>> * but that doesn't use a live rgl window during package check
>> (especially on CRAN)
>> * ... unless I do something to request this.

> I'm not sure I understand why.  Why not write examples that produce 
> rgl displays (or nothing with a null device)?  rgl itself has lots of 
> these, and passes checks on most systems.  Currently it is supposed to 
> detect display initialization failures and fall back to the null 
> device, but I don't know if this works on the only CRAN system that 
> seems to need it, the OSX system, because I haven't seen results of 
> tests yet.

My packages are used by a small community of neuroscientists with 
varying degrees of expertise in running /installing / compiling code. 
Not infrequently using these packages is the first time they use R. Most 
use macs. The mac binary version of the main nat package was out of date 
for about 6 months because it could not be built on the CRAN mac because 
of some kind of rgl problem on that machine (you probably know what that 
was - I presume it was difficult to fix!). This forces my users to use 
devtools for installation and also means that the install instructions 
for downstream packages depending on nat are insufficient because they 
assume that nat can be fetched from CRAN.

By running rgl with the null device on CRAN I still exercise the 
relevant code but insulate myself from this kind of issue.

>> I think what I may try is changing my .onLoad to look something like
>> this:


> I would be careful about that -- the CRAN people want to run realistic 
> tests, and they will likely object if you are trying to act 
> differently on their system than on your users' systems.

You're right that's something to be careful about. I guess I want to use 
the null device during check, not just on CRAN – it's annoying to have 
X11 windows cropping up when coding. I'd argue, that this is actually 
less restrictive than skipping tests on CRAN – which as far as I know 
is perfectly acceptable. The problem is that there are no simple 
mechanisms to skip example code (rather than tests) – hence the 
approach of putting code to test/set rgl.useNULL status in .onLoad that 
you originally suggested.

Thanks again for advice/feedback.

Best wishes	,


Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge, CB2 OQH, UK


More information about the R-package-devel mailing list