Displaying 20 results from an estimated 100 matches similar to: "trouble with S4 methods for group "Summary""
2006 Oct 11
1
dispatching on group generics with more than one formal
please see the code below. foo2 fails to dispatch correctly, but foo
does fine. i have tried 'cacheMetaData(1)' and a number of different
variants of 'cacheGenericsMetaData', on the possibility there is a
caching issue. but i still can't sort it out.
also one general question: does it really matter what's in the body
of the function definition in a
2006 Oct 19
1
default arguments in generics and methods
i believe the following is true but would appreciate confirmation
that it is intended behavior and will continue:
if a default argument is employed in the definition of a generic
function, and the generic is called with the argument in question
(call it 'ARG') missing, then the method for signature (..., ARG =
"missing", ...) will be called by 'standardGeneric'
2006 Sep 04
1
setMethod("Summary")
Hi everyone and thanks for being patient. I've used "!.foo"() et
seq pro tem.
Next problem: how to define "Summary" methods for brobs.
?max says
'max' and 'min' are generic functions: methods can be defined for
them individually or via the 'Summary' group generic. For this to
work properly, the arguments '...' should be
2005 Nov 23
3
date/time arithmetic
On the help page "DateTimeClasses {base}" it says:
"One can add or subtract a number of seconds or a difftime object
from a date-time object, but not add two date-time objects."
However,
> x<-Sys.time(); y<-Sys.time()+3600
> diff<-y-x
> x; y; diff
[1] "2005-11-23 19:58:20 GMT"
[1] "2005-11-23 20:58:20 GMT"
Time difference of 1 hours
2006 Sep 27
1
potential setClass bug (with user-defined environment)
the following returns an error in an 'exists' call on my machine
MyEnv <- new.env()
setClass("Numeric", "numeric", where=MyEnv)
franklin parlamis
> version
_
platform powerpc-apple-darwin8.7.0
arch powerpc
os darwin8.7.0
system powerpc, darwin8.7.0
status beta
major 2
minor 4.0
year
2005 Oct 12
1
bug checking
I have observed the following behavior, wondering if it is a bug
before I submit a report.
I am using the plot function with call: plot(X, Y,
col="red", . . . ) where X is an object that inherits from classes
'dates' and 'times' (created with the 'dates' function from package
'chron') and y is a numeric vector. The color red is applied to the
2006 Sep 23
1
generics for primitive functions
i think these two code snippets exhibit a bug. they are identical
but for the inclusion of an initial line in snippet [2]
[1]
setMethod("Math", signature(x = "numeric"), function(x) "Works")
getGeneric("sqrt")(4)
[2]
getGeneric("sqrt")(4)
setMethod("Math", signature(x = "numeric"), function(x) "Works")
2006 Oct 20
1
understanding virtual classes and extensions thereof
I am having some trouble creating a hierarchy of virtual classes
(akin to the class structure in the 'Matrix' package). I think they
arise from my not understanding the best way to specify virtual
subclasses of a virtual class. please see questions below code.
setClass("mom")
setClass("kid1", representation("mom", "VIRTUAL"))
2004 Feb 26
2
package 'stats' needs import directive for 1.9.0?
I maintain the Irregular Time Series (its) package on CRAN. I am currently
testing a release. Under 1.8.1 I am able to define a S4 generic 'start' as
follows:
if(!isGeneric("start")) {setGeneric("start", useAsDefault=start)}
Under 1.9.0, Rcmd check generates an error, as 'start' is not recognised.
If I use the NAMESPACE directive IMPORT, all is well:
2006 Sep 14
1
attributes of S4 objects
I am having a bit of a struggle deciding when to use attributes with
S4 objects. Clearly the 'class' attribute will always be present.
But it is not clear to me whether the architects of the methods
package intend that other attributes, such as 'names', will still be
used when the S4 implementation is complete.
I notice that, when you create a formal object from an
2004 Jan 08
3
S3, S4, namespace
I have encountered an issue which I have been unable to resolve, involving
an S3 generic (print) being declared S4 generic in a package, and the method
being exported. This all works fine - the problem occurs when I try to
import the method to another package.
Here is the bit that works fine. -------------
#the .r file for package bar
2006 Sep 21
1
validity testing as part of '@<-'
'methods' package feature request / discussion starter:
perhaps a call to 'validObject' should occur at part of any slot
replacement operation (and the operation not be carried out if it
would invalidate the object)? this may prevent the need for
prophylactic 'validObject' calls in other user-defined functions. in
the example below, the slot assignment occurs
2008 May 20
1
S4 generic for lowess
Hi,
A lowess method is defined in our package for one of our S4 classes. To
explicitely define the generic this is being used
if (!isGeneric("lowess"))
setGeneric("lowess", useAsDefault = lowess)
This works fine for many other methods inherited from various R
packages. In this case a warning is issued in R CMD check:
* checking R code for possible problems ... NOTE
2006 Sep 20
1
residual '*tmp*' variable after "[<-" error
self-sanity check prior to filing a bug report:
attempted replacement that generates an error leaves a '*tmp*'
variable in the global environment.
test <- 1:10
test[2:4] <- expression(e)
ls()
i've read section 3.4.4 of the "R Language Definition" which
discusses the mechanism for replacement, and it is not clear to me
whether this was intended, but i suspect
2010 Jan 11
1
Problem with S4 generic function print
First, if I have an S4 class boo should I define S3 method for
printing print.boo(..) or should I define S4 method print(..).
I mainly need to define print function only because some user might
call it and then I would like to dispatch the call to
right function instead.
Second, it seems that by defining S4 generic function print, it is
possible to break argument hinting on the status bar.
2011 Jun 01
1
Overloading S4 methods
Dear all,
I am experiencing some problems with S4 method overloading. I have
defined a generic for graphics:plot, using
setGeneric("plot", useAsDefault = plot)
and with
importFrom('graphics', 'plot') and
exportMethods('plot') in the NAMESPACE file of pkg A.
I then proceed to define a method for signature c('myS4class',
'missing'). This works
2008 Feb 24
2
Generic Functions
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<-")
#Returns
TRUE
#I would like to define a specific function for
2008 Feb 24
2
Generic Functions
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<-")
#Returns
TRUE
#I would like to define a specific function for
2006 May 11
1
@ accesses attributes, not just formal slots ?
Using the '@' operator, I am able to extract a 'names' attribute
assigned to a formal object.
However, I can not use the replacement form ('@<-') to assign that
attribute.
> setClass("foo", representation("numeric"))
[1] "foo"
> (new("foo", 1:4)->a)
An object of class ?foo?
[1] 1 2 3 4
> names(a) <-
2006 Oct 06
1
class unions?
the code below has me confused:
setClassUnion("index", c("numeric", "character", "logical"))
extends("numeric") # i don't see the class union
library(Matrix)
extends("numeric") # now i see the class union
i am aware that the "Matrix" package separately defines the "index"
class union.
is it the case that