[R] Build a package - check error

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Aug 19 23:03:13 CEST 2011



On 19.08.2011 22:53, Eduardo Mendes wrote:
> Dear R-users
>
> I am slowly migrating my mex files (MATLAB - Fortran and C) to R.  To get my
> own functions available on R section I have decided to learn how to build  a
> R package. I choose a simple example with a few Fortran and R functions
> (wrapper).
>
> The fortran sources are located at src and the R functions at R (as
> recommended).  The building process went ok but R CMD check did not. The
> error mgs was
>
> Error in dyn.load("fortran.so") :
>    unable to load shared object
> '/home/eduardo/R_packages/test.Rcheck/fortran.so':
>
> Although I can see that R cannot find the compiled fortran code I do not
> know what to do.   I believe it is something to do with the following lines
> in  the R-wrapper file
>
> if (!is.loaded('calnpr'))
>                     dyn.load("fortran.so")


1. If the package is called calnpr, the shared library is also called 
that way.
2. you have to provide the path to the shared library.

See ?.First.lib for how to do it in a package without NAMESPACE (and 
note that NAMESPACES are forced for the next R release).

Best,
Uwe Ligges


> How to add the path so that once the package is installed the compiled
> fortran code can be found?
>
> Many thanks
>
> Cheers
>
> Ed
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list