[R] include S4 class and methods in a package

baptiste Auguié ba208 at exeter.ac.uk
Fri Jun 27 19:44:00 CEST 2008


DeaR list,


Pardon the stupidity of this question but I've been trying this for a  
while now without success.

I've followed the example given in the green book "programming with  
data", and I now have a working example of a S4 class with a few  
methods (plot, summary, as.data.frame). It's all very nice in one  
file, but I cannot find the way to put this information in a package.  
I've created several simple packages (without S4 classes) in the past  
using package.skeleton and manual editing / adding of some files.
The question I have now is where do the setClass and setMethod live  
in the folder tree? I sort of believe they should be defined in a  
source file in the sub-directory R/, but is there a special name to  
give to these files, how do they get recognised during installation  
or build?

I've tried to find the answer in "writing R extensions" but I must  
have missed the relevant section.

Many thanks,

Sincerely,

Baptiste

PS: I'm not sure a minimal example is relevant, I could provide one  
if requested.

OS is MacOS 10.4,
 > sessionInfo()
R version 2.7.0 RC (2008-04-21 r45421)
powerpc-apple-darwin8.10.1

locale:
en_GB.UTF-8/en_US.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] datasets  utils     stats     graphics  grDevices splines    
grid      methods   base


_____________________________

Baptiste Auguié

Physics Department
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
http://projects.ex.ac.uk/atto



More information about the R-help mailing list