Displaying 20 results from an estimated 10000 matches similar to: "Signature specific S4 Method export in NAMESPACE file would be cool"
2007 Dec 08
2
NAMESPACE choices for exporting S4 methods
We are building a package, and want to create S4 methods for both head and
mean for our own BigMatrix class. Following the recommendation in "Writing
R Extensions" we use exportMethods instead of export in NAMESPACE (this is
described as being "clearer"). This works for head, but not for mean.
Obviously we importFrom(utils, head), but don't need to do this for mean,
2011 Dec 15
1
S4 NAMESPACE method imports and exports do not include (promoted?) generics
In
> R.version.string
[1] "R Under development (unstable) (2011-12-15 r57901)"
section 1.6.6 of 'Writing R Extensions' says
Note that exporting methods on a generic in the namespace will
also export the generic, and exporting a generic in the
namespace will also export its methods.
and
Note that importMethodsFrom will also import any generics defined in
2012 Dec 08
1
namespace S3 and S4 generic imports cannot both be satisfied:
PkgA wishes to write a method for 'unique' on S4 class 'A'. ?Methods indicates
that one should
setGeneric("unique")
setClass("A")
unique.A <- function(x, incomparables=FALSE, ...) {}
setMethod(unique, "A", unique.A)
Both S3 and S4 methods need to be exported in the NAMESPACE
import(methods)
S3method(unique, A)
2003 Sep 05
1
namespaces and S4 methods/classes
The current version of the methods package now has a namespace. Packages
using S4 methods and classes can have NAMESPACE files. New directives
can be included in NAMESPACE files to import and export classes and
methods.
Namespaces allow cleaner definition of the API for packages, and are
needed for future improvements to R.
NOTE: This is a major revision. In principle, it should be back
2012 Feb 26
0
Comments on R_exts section 1.6.6, Namespaces with S4 classes and methods
> R.version.string
[1] "R Under development (unstable) (2012-02-26 r58493)"
In the recent addition "It is important if you export S4 methods that
the corresponding generics are available: the requirementa on this are
stricter as from R 2.15.0. You may for example need to import plot from
graphics to make visible a function to be converted into its implicit
generic. But it is
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
2007 May 03
1
Imports/exports of S4 methods
I have a question about what to do in the following situation (please bear with
the setup):
Package A defines an S4 generic 'foo' and as well as S4 methods for 'foo' and has
exportMethods("foo")
in its NAMESPACE file.
Package B defines another method for 'foo' for class "bar" and has
importFrom(A, "foo")
exportMethods("foo")
2013 Mar 13
1
S4 generic not exported correctly / incorrect dispatch?
In this post
https://stat.ethz.ch/pipermail/bioc-devel/2013-March/004152.html
a package author reports that S4 dispatch fails. I can reproduce this with a
PkgA (attached; 'intervals' is a relatively light-weight CRAN package) that has
DESCRIPTION with
Depends: intervals
Imports: graphics
NAMESPACE:
importFrom(graphics, "plot")
export("plot")
2009 Mar 17
1
exporting s3 and s4 methods
If a package defined an S3 generic and an S4 generic for the same function (so as to add methods for S4 classes to the existing code), how do I set up the namespace to have them exported?
With
import(stats)
exportMethods(bigglm)
importClassesFrom(DBI)
useDynLib(biglm)
export(biglm)
export(bigglm)
in NAMESPACE, the S3 generic is not exported.
> methods("bigglm")
[1] bigglm.RODBC*
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
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
2009 May 18
1
S4 method dispatch and namespaces: why is default method selected
Hi,
I ran into the following peculiarity involving S4 method dispatch and
namespaces.
I develop a package which have a namespace and which depends on 'pixmap'
package, which itself does not have a namespace.
Now, in my package I have a class which has a slot for objects from
class "pixmap" and I
want to have a "plot" method for this new class. Not to clutter the
2014 Jul 11
1
Namespaces and S4 Generics
I've installed R-devel
R Under development (unstable) (2014-07-09 r66111)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
and am trying to resolve some problems that I am seeing with my
SparseM package. In prior versions I explicitly had:
setGeneric("image", function(x, ...) standardGeneric("image"))
and then used setMethod to define a method for the class matrix.csr
but
2012 Feb 26
1
improved error message when existing implicit S4 generic is not imported?
pkgA's NAMESPACE has
importFrom(graphics, plot)
exportClasses("A")
exportMethods("plot")
R/foo.R has
setClass("A")
setMethod("plot", "A", function(x, y, ...) {})
During R CMD INSTALL pkgA_1.0.tar.gz we are told
** preparing package for lazy loading
Creating a generic function for 'plot' from package
2007 May 01
1
Possible problem with S4 dispatch
Hi,
First a bit of disclaimer... I haven't isolated this problem into an
easy to reproduce case, and I won't be surprised if the root cause is
a fault in my code's use of name spaces or some such.
The error I'm seeing is one in which the desired method is not found.
What worries me in terms of my expectations of how to debug the
problem is that showMethods and selectMethod both
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
2010 Feb 06
1
Posting an 'S4-creating Package Problem'...
Hello R-Team,
May you help me to post a 'S4-creating Package Problem'?
Thanks already now for supporting.
The problem sounds like:
Hello R forum,
while compiling my R-package these 'Warnings' occur:
...
Warnung in matchSignature(signature, fdef, where) :
in the method signature for function "plot" no definition for class:
"prediction"
Warnung in
2011 Nov 09
1
Define S4 methods for 'plot'
Hi the list
I am creating a package and I have a problem to define a S4 method for plot.
I define a class 'A' and a class 'B'. I want to define a function plot for
signature c(A,missing) and another method plot for signature c(A,B). My code
is the following :
In /package/R/ directory:
--- main.R ---
setGeneric("plot",function(x,y,...){standardGeneric("plot")})
2015 May 10
2
S4 method dispatch sometimes leads to incorrect when object loaded from file?
Loading an S4 object from a file without first loading the library sometimes (?,
the example below and actual example involves a virtual base class and the show
generic) leads to incorrect dispatch (to the base class method).
The attached package reproduces the problem. It has
setClass("A")
setClass("B", contains="A")
setMethod("show", "A",
2008 Jul 25
1
S4 class and Package NAMESPACE [NC]
Hello,
I am trying to make a R package with S4 classes. To do so, i do as usual
(when no S4 were involved, i.e without NAMESPACE file) and I've got errors
in class refering to other classes in the package.
So I use a NAMESPACE file to declare classes, it works fine, but now I
have to declare each functions in the NAMESPACE file. Since I have a lot
of functions, it's not very easy.