[R-pkg-devel] Imported function cannot be found. (Solved.)

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Fri Jan 18 03:13:03 CET 2019


Thanks Dirk.  Your suggestion worked perfectly.  (See inline below.)

On 1/18/19 2:50 PM, Dirk Eddelbuettel wrote:
> 
> On 18 January 2019 at 11:59, Rolf Turner wrote:
> |
> | I am build a package in which there is a function which calls upon the
> | function brm() from the brms package.
> |
> | In my DESCRIPTION file I have the line
> |
> | > Imports: lme4, brms, glmmTMB, MASS, lattice, Rcpp, rmutil
> |
> | In my NAMESPACE file I have the line
> |
> | > importFrom("Rcpp","cpp_object_initializer")
> |
> | Yet when I call the function from my package which calls brm() I get the
> | error message:
> |
> | > Error in cpp_object_initializer(.self, .refClassDef, ...) :
> | >   could not find function "cpp_object_initializer"
> |
> | Clearly I am doing something wrong.  Can someone please point me in the
> | direction of correctness?
> |
> | Note that there is indeed a function cpp_object_initializer() in the
> | Rcpp package.
> |
> | If more detail is required in order for guidance to be provided I am of
> | course more than happy to supply such detail.
> 
> Which of these packages uses Rcpp Modules?  Yours?  brms::brm()

Definitely brms:brm()!!!  Using Rcpp is far beyond my limited capabilities.

> It may be more prudent replace
> 
>     importFrom("Rcpp","cpp_object_initializer")
> 
> with
> 
>     import(Rcpp)
> 
> which tickles a different initialization for Rcpp. I just checked two Rcpp
> Modules using packages of mine, and they use that latter approach.

Yep.  Tried that, and it works.  It all seems like sorcery to me, but I 
guess if I (or somebody more clever than I, e.g. your very good self) 
can get it to work, then that's all that matters.

Thanks again.

cheers,

Rolf

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-package-devel mailing list