[R-pkg-devel] Weird error on CRAN linux check

Joris Meys Jori@@Mey@ @ending from ugent@be
Wed Jul 4 21:23:57 CEST 2018


I just took a look at your repo, and two remarks:

- you use roxygen, and used both @export and @S3method. The latter one is
deprecated, so you should use only @export, or @method (see eg Hadley's
answer here : https://github.com/klutometis/roxygen/issues/741 )

- You're using some code in attributes.R that should generate all the
getters and setters automatically, but it looks as if these objects aren't
generated in the right order/environment/... to be registered correctly.

The part where I get confused, is the following. After installing:

> ht <- huxtable(a = 1:3, b = 1:3)
> align(ht)
Error in UseMethod("align") :
  no applicable method for 'align' applied to an object of class
"c('huxtable', 'data.frame')"
> methods(align)
[1] align.huxtable*
see '?methods' for accessing help and source code
> getFromNamespace("align.huxtable","huxtable")
function (ht)
attr(ht, "align")
<bytecode: 0x0000000015f8bb88>
<environment: 0x0000000016840c18>

The last line is what bothers me. That should be
<environment:namespace:huxtable>, like this:

> environment(huxtable)
<environment: namespace:huxtable>

So you generate the functions, they somehow get registered but they get
created in the wrong environment as far as I can tell. That's where I would
start looking.

CHeers
Joris


On Wed, Jul 4, 2018 at 8:12 PM, David Hugh-Jones <davidhughjones using gmail.com>
wrote:

> I figured that. Actually I just tried this. I now get the interesting
> result that all calls to a generic fail with the UseMethod error...?
>
> On Wed, 4 Jul 2018 at 16:12, Joris Meys <Joris.Meys using ugent.be> wrote:
>
>> On Wed, Jul 4, 2018 at 4:22 PM, Hadley Wickham <h.wickham using gmail.com>
>> wrote:
>>
>>> I don't think it's related to the error, but you shouldn't be exporting
>>> this:
>>>
>>> export("align<-.huxtable")
>>>
>>> You should generally only export the method.
>>>
>>
>> Hadley means to say that you should generally only export the generic,
>> not the individual methods.
>> More information here:
>>
>> https://cran.r-project.org/doc/manuals/R-exts.html#Registering-S3-methods
>>
>> Cheers
>> Joris
>> --
>> Joris Meys
>> Statistical consultant
>>
>> Department of Data Analysis and Mathematical Modelling
>> Ghent University
>> Coupure Links 653, B-9000 Gent (Belgium)
>>
>> <https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>
>>
>> tel: +32 (0)9 264 61 79
>> -----------
>> Biowiskundedagen 2017-2018
>> http://www.biowiskundedagen.ugent.be/
>>
>> -------------------------------
>> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>>
> --
> Sent from Gmail Mobile
>



-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
<https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>

tel: +32 (0)9 264 61 79
-----------
Biowiskundedagen 2017-2018
http://www.biowiskundedagen.ugent.be/

-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list