I'm having a little trouble building a package with a namespace. Suppose I have 
two functions: g and f and I want to build the package foo. Suppose f is a 
function that has an internal purpose and should not be visible to the user. 
Additionally, I do not want to write a help (Rd) file for f. The only function 
that should be visible to the user and have an associated help function is g.

First off, if I follow the normal (windows-based) procedures for building this 
package without the namespace I have no problems. I do build, check, and 
install all without fail and can use these functions in an R session. 

Now, I add in a namespace file in the top level directory and, following the 
namespace example found at the link below, I construct a namespace that has the 
following in it:

### begin namespace file
useDynLib(foo)
export(g)
### end namespace file
http://cran.r-project.org/doc/manuals/R-exts.html#An-example

Because I don't want there to be an .Rd file for the function f I remove it 
from the "man" directory. I say remove because I use package.skeleton() and it 
automatically creates an empty .Rd file for the function f. This leaves only 
g.Rd and foo-package.Rd in the man directory.

After running Rcmd check foo, I get the following:

C:\Program Files\R\R-2.9.2\bin>Rcmd check g:\foo
* checking for working pdflatex ...pdflatex: not found
 NO
* checking for working latex ...latex: not found
 NO
* using log directory 'C:/Program Files/R/R-2.9.2/bin/foo.Rcheck'
* using R version 2.9.2 (2009-08-24)
* using session charset: ISO8859-1
* checking for file 'foo/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'foo' version '1.0'
* checking package name space information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for .dll and .exe files ... OK
* checking whether package 'foo' can be installed ... OK
* checking package directory ... OK
* checking for portable file names ... 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 library.dynam(lib, package, package.lib) :
  shared library 'foo' not found
Error: package/namespace load failed for 'foo'
Execution halted

It looks like this package has a loading problem: see the messages for
details.

The fact that latex is not found baffles me, but that's another issue which is 
ancillary to my problem. But, just for completeness, it is installed, it is in 
the path as directed by Duncan Murdoch's website for building R packages 
indicates. I've built packages many times before even though this error exists.

I think I am missing some understanding of how the namespace should be properly 
developed and used in the construction of the package. Any insight into my 
errors is appreciated.

Harold



> sessionInfo()
R version 2.9.2 (2009-08-24) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    
______________________________________________
R-help@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.

Reply via email to