Re: [R] Best way to setClass and setMethod for an R package?

2011-08-21 Thread Uwe Ligges



On 21.08.2011 00:48, Jonathan Greenberg wrote:

Folks:

I'm putting together an R package, and I was wondering where,
specifically, I put both class definitions (via setClass) as well as
setMethod calls?  Is there a particular file name I need to use?


No, any file name, e.g.
.../name_of_your_package/R/Name_of_your_class.R


Uwe Ligges




Thanks!

--j



__
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.


Re: [R] Best way to setClass and setMethod for an R package?

2011-08-21 Thread Martin Morgan

On 08/21/2011 05:56 AM, Uwe Ligges wrote:



On 21.08.2011 00:48, Jonathan Greenberg wrote:

Folks:

I'm putting together an R package, and I was wondering where,
specifically, I put both class definitions (via setClass) as well as
setMethod calls? Is there a particular file name I need to use?


Hi Jonathan

In principle, S4 methods can dispatch on multiple classes, and an 
approach has been to have files AllClasses.R and AllGenerics.R to 
implement class and generic definitions, then foo-methods.R for methods 
defined on the generic foo. An 'advantage', for the lazy amongst us, is 
that this usually leads to a collation order that is appropriate -- 
class definition before use in method dispatch -- so that the Collates: 
field in the DESCRIPTION file does not have to be maintained.


In practice many S4 generics dispatch on a single argument and while 
there might be the equivalent of AllGenerics.R, the classes and their 
associated methods are defined in MyClass-methods.R.


Martin



No, any file name, e.g.
.../name_of_your_package/R/Name_of_your_class.R


Uwe Ligges




Thanks!

--j



__
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.



--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

__
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.


[R] Best way to setClass and setMethod for an R package?

2011-08-20 Thread Jonathan Greenberg
Folks:

I'm putting together an R package, and I was wondering where,
specifically, I put both class definitions (via setClass) as well as
setMethod calls?  Is there a particular file name I need to use?
Thanks!

--j

-- 
Jonathan A. Greenberg, PhD
Assistant Project Scientist
Center for Spatial Technologies and Remote Sensing (CSTARS)
Department of Land, Air and Water Resources
University of California, Davis
One Shields Avenue
Davis, CA 95616
Phone: 415-763-5476
AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307

__
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.