[R] Newbie creating package with compiled code

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jul 5 00:58:27 CEST 2007


On 04/07/2007 6:43 PM, Edna Bell wrote:
> Hi R Gurus!
> 
> I'm trying to create a test package using the package.skeleton function.
> I wanted to  add some compiled code too.
> In the src library, I put together a baby subroutine, compiled it and created
> a test.dll
> 
> When I use the R cmd build, it works fine.  But I get into trouble
> with the R CMD check section.
> 
> 
> /home/Desktop/R-2.5.1/bin # ./R CMD check mypkg
> * checking for working latex ... OK
> * using log directory '/home/Desktop/R-2.5.1/bin/mypkg.Rcheck'
> * using R version 2.5.1 (2007-06-27)
> * checking for file 'mypkg/DESCRIPTION' ... OK
> * checking extension type ... Package
> * this is package 'mypkg' version '1.0'
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking whether package 'mypkg' can be installed ... OK
> * checking package directory ... OK
> * checking for portable file names ... OK
> * checking for sufficient/correct file permissions ... OK
> * checking DESCRIPTION meta-information ... OK
> * checking top-level files ... OK
> * checking index information ... OK
> * checking package subdirectories ... OK
> * checking R files for non-ASCII characters ... OK
> * checking R files for syntax errors ... OK
> * checking whether the package can be loaded ... ERROR
> Error in .find.package(package, lib.loc, verbose = verbose) :
>         there are no packages called 'mypkg', 'stats', 'graphics',
> 'grDevices', 'utils', 'datasets', 'methods', 'base'
> Error in library(mypkg) : .First.lib failed for 'mypkg'
> Execution halted
> 
> It looks like this package has a loading problem: see the messages for
> details.
> 
> Here is the mypkg.R file
> sss <- "/home/hodgesse/Desktop/R-2.5.1"
> .First.lib <- function(lib=sss,pkg="mypkg")
> 	   library.dynam("mypkg.so",pkg="mypkg",lib=sss)

That's a very strange .First.lib.  I think you'll have more success with 
a simpler one:

.First.lib <- function(libname, pkgname)
   library.dynam("mypkg", package=pkgname, lib.loc=libname)

(and sss is not needed at all).

Duncan Murdoch

> 
> 
> f <- function(x,y) x+y
> 
> g <-function(x,y) x-y
> 
> 
> Thanks for any help
> 
> Edna
> mailto: edna.bell01 at gmail.com
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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