Re: [R] Loading namespaces

2005-12-08 Thread Matthias Kohl
BBK schrieb:

>Just noticed the mssing ) at the end of the setClass statement, it is there
>in the orginal
>
>Phineas
>
>-Original Message-
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] 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
>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)
>  
>
Do you mean

.onLoad <- function(lib, pkg) require(methods)

as given in Section 1.6.6 of "Writing R Extensions"

>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?
>  
>
see Section 1.6.6 (ibid.): "There needs to be an .onLoad action to
ensure that the methods package is loaded and attached"

hth
Matthias

>Phineas Campbell
>
>
>  
>
>>version
>>
>>
> _
>platform sparc-sun-solaris2.9
>arch sparc
>os   solaris2.9
>system   sparc, solaris2.9
>status
>major2
>minor1.0
>year 2005
>month04
>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
>
>__
>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
>  
>


-- 
StaMatS - Statistik + Mathematik Service
Dipl.Math.(Univ.) Matthias Kohl
www.stamats.de

__
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


Re: [R] Loading namespaces

2005-12-08 Thread BBK
Just noticed the mssing ) at the end of the setClass statement, it is there
in the orginal

Phineas

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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
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
major2
minor1.0
year 2005
month04
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

__
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


[R] Loading namespaces

2005-12-08 Thread BBK
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
major2
minor1.0
year 2005
month04
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