[R-pkg-devel] Weird error on CRAN linux check
Duncan Murdoch
murdoch@dunc@n @ending from gm@il@com
Wed Jul 4 22:37:13 CEST 2018
On 04/07/2018 3:44 PM, Iñaki Úcar wrote:
> It seems Joris is right. The following patch seems to solve the issue for me:
>
> diff --git a/R/attributes.R b/R/attributes.R
> index e7f4ab9..18ebdab 100644
> --- a/R/attributes.R
> +++ b/R/attributes.R
> @@ -156,6 +156,7 @@ make_getter_setters <- function(attr_name,
> attr_type = c('cell', 'row', 'col', '
> ) # end switch
>
> lapply(names(funs), function (x) {
> + environment(funs[[x]]) <- getNamespace('huxtable')
> assign(x, funs[[x]], envir = getNamespace('huxtable'))
> })
>
That looks like a harmless change for huxtable::align.huxtable, but it
might mess up other methods if they make use of the objects in that
environment.
Duncan Murdoch
> Iñaki
> El mié., 4 jul. 2018 a las 21:34, Duncan Murdoch
> (<murdoch.duncan using gmail.com>) escribió:
>>
>> On 04/07/2018 3:23 PM, Joris Meys wrote:
>>> 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.
>>>
>>
>> That shouldn't matter. That function was created in a local environment
>> whose parent is <environment: namespace:huxtable> (probably by the
>> huxtable:::make_setter_getters function, but I didn't check).
>>
>> Duncan Murdoch
>>
>>
>>
>>> 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
>>>>
>>>
>>>
>>>
>>
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
>
>
More information about the R-package-devel
mailing list