Displaying 20 results from an estimated 3000 matches similar to: "Imports/exports of S4 methods"
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
2011 Mar 26
1
another import puzzle
Dear list,
I have another (again possibly boneheaded) puzzle about importing,
again encapsulated in a nearly trivial package. (The package is posted
at <http://www.math.mcmaster.ca/bolker/misc/coefsumtest_0.001.tar.gz>.)
The package consists (only) of the following S3 method definitions:
coeftab <- function(object, ...) UseMethod("coeftab",object)
coeftab.default <-
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
2011 Oct 06
1
multiple defines of diag
The current coxme code has functions that depend on bdsmatrix and others
that depend on Matrix, both those pacakges define S4 methods for diag.
When loaded, the message appears:
replacing previous import ?diag? when loading ?Matrix?
Questions:
1. Do I need to worry about this? If so, what can I do about it?
I suppose I could add an importFrom directive, but it will be a pain
unless there
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
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
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
2005 Apr 28
1
strange behaviour of importFrom directive in name space
Dear listers,
After activating the name space for my bioconductor package (prada) I
successfully ran R CMD check. However when loading the package in R and
running the examples the imported function brewer.pal from package
RColorBrewer is not found. I can directly call brewer.pal from the
RColorBrewer name space typing RColorBrewer::brewer.pal, but it is not
imported into my prada name space. When
2005 Apr 28
1
strange behaviour of importFrom directive in name space
Dear listers,
After activating the name space for my bioconductor package (prada) I
successfully ran R CMD check. However when loading the package in R and
running the examples the imported function brewer.pal from package
RColorBrewer is not found. I can directly call brewer.pal from the
RColorBrewer name space typing RColorBrewer::brewer.pal, but it is not
imported into my prada name space. When
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,
2007 May 01
1
Questions about name space directives
Hi,
I'm hoping to get some clarification of the intent of some of
directives used in NAMESPACE files.
1. Is import(somePkg) also intended to import all classes and methods
that are exported via exportClasses and exportMethods in somePkg?
I think import pulls in classes and methods, but it isn't clear
from the docs whether this is as intended.
2. What is exportMethods intended
2006 Jan 08
2
exporting methods/classes
Dear R People:
I'm still struggling with sending methods and classes as part of
creating a new package.
Where does the .onLoad function go? Within R itself or in a file
in one of the new package directories?
Here are my latest efforts:
Here's the last part of the woof1-Ex.Rout
> library('woof1')
Error in loadNamespace(package, c(which.lib.loc, lib.loc),
keep.source =
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)
2005 Nov 28
1
import of Namespaces
Dear R devels,
let's say I have three packages "pkg1", "pkg2" and "pkg3" which all
contain new S4 classes and methods. Where "pkg3" depends on "pkg2" and
"pkg2" depends on "pkg1". Moreover, all three packages have namespaces.
1) I use ".onLoad <- function(lib, pkg) require(methods)". Do I also
have to
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
2007 Aug 09
1
S4 based package giving strange error at install time, but not at check time
Hi, I have a S4 based package package that was loading fine on R
2.5.0 on both OS X and
Linux. I was checking the package against 2.5.1 and doing R CMD check
does not give any warnings. So I next built the package and installed
it. Though the package installed fine I noticed the following message:
Loading required package: methods
Error in loadNamespace(package, c(which.lib.loc, lib.loc),
2011 Dec 15
1
R CMD check fails to warn about undocumented classes and methods
In
> R.version.string
[1] "R Under development (unstable) (2011-12-15 r57901)"
PkgA promotes 'unique' to a generic and exports that
DESCRIPTION:
Imports: methods
R/f.R:
setGeneric("unique")
NAMESPACE:
export(unique)
and PkgB creates and exports a method on unique
DESCRIPTION
Imports: methods, PkgA
R/f.R:
setClass("B",
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
2007 Dec 10
1
cyclic dependency error
Dear all,
I am encountering a cyclic dependency error when running R CMD check on an R package I wrote (R version 2.6.1, Mac OS X 10.4), see the error message below.
Creating a new generic function for "print" in "clValid"
Creating a new generic function for "summary" in "clValid"
Creating a new generic function for "plot" in
2008 Apr 02
2
restrictions for attribute access <Watchdog: Virus checked>
Hello everybody,
I have a problem with accessing class attributes. I think it might be
due to namespace access restrictions or something similar, but I'm
unable to figure it out, maybe someone knows the trick how to do
it ...
I'm trying to extract some information from the summary object for a
model fitted using the lmer function from the lme4 package:
smry <- summary(lmer(foo