Displaying 20 results from an estimated 3000 matches similar to: "instantiating a reference class with an initialize() method from .onLoad fails"
2015 May 12
1
S4 method dispatch sometimes leads to incorrect when object loaded from file?
>>>>> Martin Morgan <mtmorgan at fredhutch.org>
>>>>> on Mon, 11 May 2015 10:18:07 -0700 writes:
> On 05/10/2015 08:19 AM, Martin Morgan wrote:
>> 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)
2013 May 08
1
Namespace/inheritance problem in S4 methods for a union class
Hi,
I started this post on bioc-devel but this seems to be more general:
https://stat.ethz.ch/pipermail/bioc-devel/2013-May/004311.html
See reproducible example from Martin below.
Thank you.
Renaud
---------- Forwarded message ----------
From: Martin Morgan <mtmorgan at fhcrc.org>
Date: 7 May 2013 19:55
Subject: Re: [Bioc-devel] ExpressionSet and LumiBatch: inheritance problem
in S4
2015 May 11
0
S4 method dispatch sometimes leads to incorrect when object loaded from file?
On 05/10/2015 08:19 AM, Martin Morgan wrote:
> 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
The package was attached but stripped; a version is
2011 Oct 15
2
.onLoad failing because could not find function "loadMethod"
Hi,
This strange warning happen sometimes when running 'R CMD check':
* checking whether the package can be loaded with stated dependencies
... WARNING
Error : .onLoad failed in loadNamespace() for ?pkgB?, details:
call: length(new("A"))
error: could not find function "loadMethod"
Error: package/namespace load failed for ?pkgB?
Execution halted
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",
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
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
2015 Jul 08
0
List S3 methods and defining packages
Thanks Kevin, this indeed clarifies a bit the S3 method registration universe.
On 8 July 2015 at 15:48, Kevin Wright <kw.stat at gmail.com> wrote:
> Not sure if this answers your question, but you can't unregister a method. See
>
> http://tolstoy.newcastle.edu.au/R/help/06/07/30791.html
>
> Kevin Wright
>
>
> On Wed, Jul 8, 2015 at 5:09 AM, Renaud Gaujoux
>
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 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)
2005 Dec 08
1
Loading namespaces
I'm creating a package for my own use that uses some S4 classes but no
methods.
I have a file called NAMESPACE it contains the line:
exportClasses("foo")
and at the top of the R file I have
setClass("foo", representation(x="numeric")
and the line:
.onLoad<-function(libname,pkgname)
When I run R CMD check I get Syntax error in the only R file. If I
2011 Jul 19
1
requiring NAMESPACE re-installation marked as old.packages?
It would be convenient if, under R-devel r56422, packages that require
re-installation because they do not have a NAMESPACE were marked as
old.packages, so their lack of functionality can be discovered more easily.
> "snow" %in% row.names(old.packages())
[1] FALSE
> library(snow)
Error in library(snow) :
package 'snow' does not have a NAMESPACE and should be
2009 Jul 07
0
Protection stack overflow when calling setGeneric()/setMethod() from within .onLoad()
Hi list,
Calling setGeneric()/setMethod() from within the .onLoad() hook
of MyPkg package produces the following error:
> gctorture(TRUE)
> library(MyPkg)
.onLoad(): ok1
.onLoad(): ok2
Error : protect(): protection stack overflow
Error : .onLoad failed in 'loadNamespace' for 'MyPkg'
Error: package/namespace load failed for 'MyPkg'
This is with
2010 Mar 22
1
Some more help on S4 mechanism
Hello to the list
Some days ago, I placed a question on this maling-list and received an
answer from Martin
that I tried to follow. Unfortunately, I am still puzzled by the next step.
I spent the whole Week-end in gathering information from the net.
Some of them are almost contridtcory and I lack a good document to help me.
So my first question would beL Is there a convenient document which
2013 Oct 03
1
check warning with .onLoad() and setClass()
Hi
I am writing a package in which I define a new class in the .onLoad()
hook:
,----
| .onLoad <- function(libname, pkgname) {
| setClass(
| "inDrak",
| representation(
| init = "SpatialGridDataFrame"
| ),
| contains = "simObj"
| )
| }
`----
The class "simObj" is defined in the package, which
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 =
2011 Jun 23
1
Class not found when search in .onLoad
Hi,
I am facing with a strange behaviour of isClass and extends when these
are called in .onLoad in both R 2.12.1 and R 2.13.0. This is preventing
my package from doing some object initializations at a proper place
(i.e. in .onLoad).
Suppose one defines two S4 classes in a package, and that one needs to
check the inheritance between these two when loading the package (e.g.
to validate slots
2005 Nov 21
2
NAMESPACE, S4, and .onLoad
The Writing R Extensions manual instructs developers who use S4
classes and methods in a package with a name space to:
There needs to be an .onLoad action to ensure that the methods package
is loaded and attached:
.onLoad <- function(lib, pkg) require(methods)
I'm wondering if listing methods in the Depends field of the package's
DESCRIPTION file is sufficient.
2015 Jul 07
0
List S3 methods and defining packages
On 07/07/2015 02:05 AM, Renaud Gaujoux wrote:
> Hi,
>
> from the man page ?methods, I expected to be able to build pairs
> (class,package) for a given S3 method, e.g., print, using
>
> attr(methods(print), 'info').
>
> However all the methods, except the ones defined in base or S4
> methods, get the 'from' value "registered S3method for print",