Displaying 20 results from an estimated 6000 matches similar to: "S4 generic surprise"
2007 Jan 31
2
Problems with definitions of S4-generics
Hello all,
I'd like to report a problem related to S4 classes.
Platform:
Mac G4/400 PCI (PPC-architecture)
Mac OS 10.4.8
R 2.4.1 for Mac OS X (CRAN binary, 2006-12-19) w/ R.app 1.18
Last December, Simon Urbanek confirmed that the issue is not platform
related, and that it is most likely a bug. He suggested to post my report
to "the appropriate mailing list" -- I choose r-devel.
2006 Feb 07
0
S4 documentation
1. promptClass generated a file that included
\section{Methods}{
No methods defined with class "mspathDistributedCalculator" in the
signature.
}
Yet there are such methods. Is this a not-working yet feature, or is
something funny going on (maybe I have definitions in the library and in
the global workspace...)?
2. Is the \code{\link{myS4class-class}} the proper way to
cross-reference a
2006 Jan 31
2
an unpleasant interaction of environments and generic functions
I've run into an unpleasant oddity involving the interaction of
environments and generic functions. I want to check my diagnosis, and
see if there is a good way to avoid the problem.
Problem:
A library defines
"foo" <- function(object) 1
setMethod("foo", c("matrix"), function(object) 30)
After loading the library
foo(0) is 1
foo(matrix()) is 30
foo is a
2012 Apr 12
1
R-2.15.0 and Exporting Methods Converted To S4 Generic
Late to the show on this release, unfortunately.
One of our production packages no longer builds under R-2.15.0
with the following message.
** testing if installed package can be loaded
Error: Function found when exporting methods from the namespace
'SuperCurve' which is not S4 generic: 'image'
Possibly relevant clues follow:
## From R/AllGenerics.R
if
2006 Feb 14
3
S4 classes and methods with optional arguments
Hi,
i have used S4 classes to implement a unified access to random number generators
(package rstream on CRAN).
I have used a construct to allow optional arguments:
if(!isGeneric("rstream.sample"))
setGeneric("rstream.sample", function(stream,...) standardGeneric("rstream.sample"))
setMethod("rstream.sample",
2010 Sep 16
0
S4 plot generic documentation
Hi,
Say we want to supply a generic plot() in a package with a simple class,
like this:
---<--------------------cut here---------------start------------------->---
setClass("track",
representation=representation(x="numeric", y="numeric"))
if (!isGeneric("plot")) {
setGeneric("plot",
function(x, y, ...)
2009 Aug 17
2
S4 Generics and NAMESPACE : justified warning ?
Dear list,
It seems that a package (pkgB) using another package (pkgA) with S4
generics formed by taking existing functions (for example 'plot') must
not import the existing functions ('plot') in its namespace to avoid
the warning "replacing previous import: plot".
Suppose we use the simple 'import' directive in the name space of
pkgB.
pkgA and pkgB files would
2009 Oct 23
2
mysteriously persistent generic definition
Originally I made a function yearStop that took an argument "object". I
made a generic, but later changed the argument to "x". R keeps
resurrecting the old definition. Could anyone explain what is going on,
or how to fix it? Note particularly the end of the transcript below: I
remove the generic, verify that the symbol is undefined, make a new
function, and then make a
2003 Sep 27
2
does isGeneric work differently in 1.8.0 ?
Hello,
the last command (isGeneric) in following R-code (attached) produces
different output, depending on wheter 1.8.0 alpha or 1.7.1 is used.
Is that to be expected ?
Both R Versions were started with option vanilla
---------------------------------------------------
R.1.7.1:
---------------------------------------------------
> version
_
platform i686-pc-linux-gnu
arch i686
2003 Jul 26
2
How to make "<-" generic?
Hi,
perhaps a little bit unusual: is it possible to use "<- " as generic function
with a new signature?
The following example doesn't work:
> isGeneric("<-")
[1] FALSE
> setClass("A",representation(x = "numeric"))
[1] "A"
> setClass("B",representation(x = "numeric"))
[1] "B"
> myAssign.A <-
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.
2006 Sep 26
3
S4 accessors
I have a small S4 class for which I've written a page grouping many of
the accessors and replacement functions together. I would be interested
in people comments on the approach I've taken.
The code has a couple of decisions for which I could imagine
alternatives. First, even simple get/set operations on class elements
are wrapped in functions. I suppose I could just use myinstance at
2006 May 18
3
S4 classes and C
Is there any good source of information on how S4 classes (and methods)
work from C?
E.g., for reading
how to read a slot value
how to invoke a method
how to test if you have an s4 object
For writing, how to make a new instance of an S4 object.
I've found scattered hints in the archive, including a link to a talk on
this subject "I am using C code to create an S4 object based on
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
2005 Jun 02
1
Too generic with S4 methods?
I tried the following (relevant excerpt only)
setMethod("likelihood",
signature(spec="Specification", covs="vector",
states="vector"),
function(spec, covs, states) {
####
setMethod("likelihood",
signature(model="Model", path="matrix"),
function(model, path) {
This
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
Interrogating some (of my own) code in another package.
>norm.meth <- getMethod("normalize", "MatrixLike")
>message("str(norm.meth)")
>str(norm.meth)
>message("show(norm.meth at .Data)")
>show(norm.meth at .Data)
Last show() displays this:
function (object, ...)
{
.local <- function (object, method = c("median",
2007 Aug 07
1
S4 methods: unable to find an inherited method
Hello all,
I consider myself pretty new to the whole OO based programming so
I'm sorry if I'm doing something stupid.
> xml<-read.metlin(url)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "read.metlin",
for signature "url"
>read.metlin
standardGeneric for "read.metlin" defined from package
2015 Jan 28
0
[Q] Get formal arguments of my implemented S4 method
Would you please clarify your exact use case?
Thanks,
Michael
On Wed, Jan 28, 2015 at 9:02 AM, Roebuck,Paul L <PLRoebuck at mdanderson.org>
wrote:
> Interrogating some (of my own) code in another package.
>
> >norm.meth <- getMethod("normalize", "MatrixLike")
> >message("str(norm.meth)")
> >str(norm.meth)
>
>
2007 Apr 02
0
Object problems with Generic and rematchDefinition
Hello all,
Let me try this again with some code.
I am trying to make a new object and it's not working. I get :
Error in rematchDefinition(definition, fdef, mnames, fnames, signature) :
methods can add arguments to the generic only if '...' is an
argument to the generic
as my error. I have included my code. It is from the xcms package.
Any help would be great even if
2015 Jan 29
0
[Q] Get formal arguments of my implemented S4 method
At this point I would just due:
formals(body(method)[[2L]])
At some point we need to figure out what to do with this .local() confusion.
On Wed, Jan 28, 2015 at 10:07 AM, Roebuck,Paul L <PLRoebuck at mdanderson.org>
wrote:
> I'm attempting to reflect the information for use with corresponding
> fields in GUI (in a different package), to provide default values,
> argname