[R] Loading namespaces

BBK pcampbell at econ.bbk.ac.uk
Thu Dec 8 21:37:15 CET 2005

Just noticed the mssing ) at the end of the setClass statement, it is there
in the orginal


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of BBK
Sent: Thursday, December 08, 2005 8:18 PM
To: 'R-Help
Subject: [R] Loading namespaces

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

I have a file called NAMESPACE it contains the line:


and at the top of the R file I have

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

and the line:


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

Phineas Campbell

> version
platform sparc-sun-solaris2.9
arch     sparc
os       solaris2.9
system   sparc, solaris2.9
major    2
minor    1.0
year     2005
month    04
day      18
language R

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list