Re: [R] generic functions question in building a new package

2012-07-20 Thread Uwe Ligges
On 19.07.2012 22:44, zgu9 wrote: Hi all, I'm trying to build a package 'Thiele', but run into problems with generic functions. I have a class "Benefit", and defined the function "print.Benefit". When I try "R CMD check Thiele" in X11, this warning came out --- Functions/methods with usage

[R] generic functions question in building a new package

2012-07-20 Thread zgu9
Hi all, I'm trying to build a package 'Thiele', but run into problems with generic functions. I have a class "Benefit", and defined the function "print.Benefit". When I try "R CMD check Thiele" in X11, this warning came out --- Functions/methods with usage in documentation object 'Benefit'

Re: [R] Generic Functions and Dates

2011-01-31 Thread Martin Morgan
On 01/31/2011 12:15 PM, Elliot Joel Bernstein wrote: > I'm trying to write a generic function that calls different methods > depending on the structure of the argument, but not the exact type of > its contents. For example, the function 'nan2last' below works for a > numeric vector but not for a ve

[R] Generic Functions and Dates

2011-01-31 Thread Elliot Joel Bernstein
I'm trying to write a generic function that calls different methods depending on the structure of the argument, but not the exact type of its contents. For example, the function 'nan2last' below works for a numeric vector but not for a vector of Date objects. Is there any way to make it work on

[R] Generic functions with models? 'predict', 'residuals', 'fitted', ...?

2009-02-03 Thread John McHenry
Hi WizaRds! I don't know if my understanding of models is screwed up or if there's a fundamental limitation to the way they are used in R. Here's what I'd like to do: create a model and then test data against that model using generics like 'predict' and 'residuals'. The problem is that generics

Re: [R] Generic Functions

2008-02-24 Thread Martin Morgan
See the 'useAsDefault' argument to setGeneric. As an aside, if 'setType<-' is meant to be a 'setter' to change the value of a slot 'type', then I find the syntax a little redundant -- it's use > setType(x) <- "foo" implies that it is already a 'setter' without 'set' at the front. Why not jus

[R] Generic Functions

2008-02-24 Thread Dominik Locher
Hi I have some problems in defining new generic functions and classes. Just have a look at the following example: require(fPortfolio) setClass("PROBECLASS", representation( type="character" ) ) isGeneric("setType