[R] Loading namespaces

From: BBK <pcampbell_at_econ.bbk.ac.uk>
Date: Fri 09 Dec 2005 - 07:18:19 EST


I'm creating a package for my own use that uses some S4 classes but no methods.

I have a file called NAMESPACE it contains the line:

exportClasses("foo")

and at the top of the R file I have

setClass("foo", representation(x="numeric")

and the line:

.onLoad<-function(libname,pkgname)

When I run R CMD check I get Syntax error in the only R file. If I comment out the .onLoad function I get a package/namespace load failed error.

Are libname and pkgname parameters for the function .onLoad that need to explicitly stated, or does R populate them when the package is loaded?

Does .onLoad as defined above do enough to ensure that the namesapce is loaded?

Phineas Campbell

> version

         _
platform sparc-sun-solaris2.9

arch     sparc
os       solaris2.9

system sparc, solaris2.9
status
major 2
minor 1.0
year 2005
month 04
day 18
language R

         _



R-help@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 Received on Fri Dec 09 07:25:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:34 EST