[R-pkg-devel] r-patched error

David Hugh-Jones d@vidhughjone@ @ending from gm@il@com
Mon Jun 4 14:56:58 CEST 2018


Thank you very much for this thoughtful advice! I am guessing that
getNamespace("huxtable") would be another more self-documenting way to do
this. I will make the change.

David


On Mon, 4 Jun 2018 at 13:26, Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

>
> I'd worry a little bit about your "make_getter_setters" function:  it
> saves the result using
>
>    lapply(names(funs), function (x) {
>      assign(x, funs[[x]], envir = parent.frame(3)) # 3: 1 for
> function(x), 2 for lapply, 3 for the caller!
>    })
>
> That count of 3 looks like an implementation detail that could
> conceivably vary, for instance if the compiler decided to optimize out a
> call or two, or lapply's implementation changed.  (I suspect this isn't
> the cause of the error you saw, or you would have seen it a lot more:
> but I'd still fix it.)
>
> I think a safer way to find the huxtable namespace is something like
>
> huxtableNamespace <- .getNamespace("huxtable")
>
> though this is advised against; a documented but less obvious way to do
> it would be
>
> huxtableNamespace <- environment(huxtable)
>
> The "huxtable" on the right is the function; most other functions in
> your package would also be fine, as long as you haven't done anything
> tricky to change their environments.
>
> With one of those definitions, you could change your lapply() to
>
>    lapply(names(funs), function (x) {
>      assign(x, funs[[x]], envir = huxtableNamespace)
>    })
>
>  > Checks are passing fine on other platforms. Is this just a weirdness
> to do
>  > with the changes in R 3.5.0 on Linux? Or does it indicate a real
> problem?
>
> A possibility is memory corruption at the C level.  Since you don't have
> any C code in huxtable that couldn't be caused by what you did, but you
> might still be a victim of it.
>
> Duncan Murdoch
>
>
> >
> > Cheers,
> > David
> >
> >      > ### ** Examples
> >      >
> >      >
> >      > ht <- huxtable(a = 1:3, b = 1:3)
> >      > align(ht) <- 'right'
> >      Error in UseMethod("align<-") :
> >       no applicable method for 'align<-' applied to an object of class
> > "c('huxtable', 'data.frame')"
> >      Calls: align<-
> >      Execution halted
> > Flavor: r-patched-linux-x86_64
> > <
> https://www.r-project.org/nosvn/R.check/r-patched-linux-x86_64/huxtable-00check.html
> >
> >
> > Version: 4.0.0
> > Check: re-building of vignette outputs
> > Result: WARN
> >      Error in re-building vignettes:
> >       ...
> >      Quitting from lines 52-104 (design-principles.Rmd)
> >      Error: processing vignette ‘design-principles.Rmd’ failed with
> > diagnostics:
> >      no applicable method for ‘bold’ applied to an object of class
> > "c('huxtable', 'data.frame')"
> >      Execution halted
> > Flavor: r-patched-linux-x86_64
> > <
> https://www.r-project.org/nosvn/R.check/r-patched-linux-x86_64/huxtable-00check.html
> >
> > David
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-package-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
>
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list