Displaying 20 results from an estimated 20000 matches similar to: "Problem calling $ inside a $ method"
2006 May 11
2
S4 initialize methods, unexpected recursive callNextMethod
Hi,
Given a simple three class hierarchy: A <-- B <-- C
I want to define an initialize method for each class such that when I
call new("C", x=5), the initialize methods for A and B are used to
incrementally build the object.
When I do what seems obvious to me using callNextMethod, I get an
infinite recursion. An example follows...
setClass("A",
2006 Jan 25
2
Using substitute from inside an S4 method
Hi all,
I would like to access the name of a variable passed to an S4 method.
For a function, I would do this:
f <- function(x) as.character(substitute(x))
This also works for a the examples I have tried for methods that do
not have extra, non-dispatch args:
setGeneric("A", function(x, ...) standardGeneric("A"))
setMethod("A",
2006 Oct 17
1
Caching bug with showMethods?
showMethods isn't reporting inherited methods when it is first
called. The methods are there and after calling them, showMethods
gives the right output.
Here is an example (using R-devel r39647):
setClass("A", representation(x="numeric"),
prototype=list(x=1))
setClass("B", contains="A",
prototype=list(x=2))
2007 Mar 15
4
R 2.5.0 devel try issue in conjuntion with S4 method dispatch
Hi,
after updating R 2.5.0 devel yesterday we today observed many new
unexpected failures in our daily package build and test system runs,
which can be traced to recent changes in the implementation in try()
(as noted in NEWS).
Investigating this new implementation I come across an issue in
conjuntion with using S4 classes and methods. try(expr) does not return an
object with attribute
2006 Apr 07
4
setIs and method dispatch in S4 classes
Dear all,
I have a question regarding setIs and method dispatch in S4 classes:
Consider the following example:
#####################################################
## A02 "contains" A01 by setIs:
setClass("A01", representation(a="numeric",b="numeric"))
setClass("A02", representation(a="numeric",d="numeric"))
2007 Apr 26
1
Problem with R-2.5.0 patched and Matrix package
Hi,
Using latest R 2.5.0 Patched, I'm unable to install the Matrix package
from cran.fhcrc.org.
I get:
Creating a new generic function for "isSymmetric" in "Matrix"
Creating a new generic function for "unname" in "Matrix"
Error in conformMethod(signature, mnames, fnames, f) :
In method for function "!": formal arguments omitted in
2007 Aug 17
2
Overriding S4 methods in an installed package
Is it possible to override S4 methods in an installed package?
The naive
library("pkg")
setMethod("foo", signature(obj = "bar"),
function(obj , x, y) { new definition }
, where="package:pkg")
results in the error
Error in setMethod("foo", signature(obj = "bar"), function(obj, :
the environment "pkg" is
2007 Apr 20
1
infinite recursion when printing former S4 objects
Hello all,
An S4 class that contains matrix can be converted into a matrix using
as(). When the resulting object is printed implicitly at the command
line, all is well. When print() is explicitly called, I see an
infinite recursion.
Here is an example:
## create a subclass of matrix
> setClass("Foo", representation(name="character"), contains="matrix")
2007 Apr 15
1
unable to find inherited method for function "edges", for signature "ugsh", "missing"
I am new to using S4 methods and have run into this problem (on Windows XP using R 2.4.1): I am writing a package in which I use the graph package. I define my own classes of graphs as:
setOldClass("graphsh")
setOldClass("ugsh")
setIs("ugsh", "graphsh")
(I know that I "should have" used setClass instead - and I will eventually - but right now
2006 Apr 12
1
yet another problem with S4 dispatch (with setClassUnion)
Dear John and Seth, dear R-devels,
once again the question of method dispatch in S4 -- this time with
setClassUnion(); taking up your advice in
https://stat.ethz.ch/pipermail/r-devel/2006-April/037200.html
https://stat.ethz.ch/pipermail/r-devel/2006-April/037201.html
I have been too quick in stating that
>setClassUnion()---at least in my case---solves the problem;
>
The problem arises
2007 Jun 04
2
locked environment and inheritance
Hi,
I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create
a S4 class which extends (adds 2 slots) another S4 class from some other package. The class
should be created in "myPkg" environment (and not global environment).
Using:
setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2007 May 17
3
RFC: adding an 'exact' argument to [[
Hi all,
One of the things I find most problematic in R is the partial matching
of names in lists. Robert and I have discussed this and we believe
that having a mechanism that does not do partial matching would be of
significant benefit to R programmers. To that end, I have written a
patch that modifies the behavior of "[[" as follows:
1. [[ gains an 'exact' argument with
2006 Feb 08
2
NAMESPACE Q: does import as exist?
Is there a way to rename a function when importing it? I want to say,
"import yourFunc from Foo as myFunc" in the NAMESPACE file.
Does this exist and I've missed it? If it doesn't exist, would others
think it useful (and possible)?
Best,
+ seth
2007 May 27
2
[Bioc-devel] promptClass
promptClass fails to identify methods associated with the class. Here
is a fix:
Index: promptClass.R
===================================================================
--- promptClass.R (revision 41719)
+++ promptClass.R (working copy)
@@ -165,7 +165,7 @@
if (nmeths > 0) {
.meths.body <- " \\describe{"
for (i in 1:nmeths) {
- .sigmat
2008 Sep 15
2
S4 coercion responsibility
Should functions or the user be responsible for coercing an S4 object
argument containing the proper object (and thus should below be
considered a bug in the packages or not)?
The example is with RSQLite but the same thing happens with RMySQL, and
other DBI packages.
> library("RSQLite") Loading required package: DBI
> m <- dbDriver("SQLite")
> con <-
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
2007 Jul 21
2
dict package: dictionary data structure for R
Hi all,
The dict package provides a dictionary (hashtable) data
structure much like R's built-in environment objects, but with the
following differences:
- The Dict class can be subclassed.
- Four different hashing functions are implemented and the user can
specify which to use when creating an instance.
I'm sending this here as opposed to R-packages because this package
will
2006 Jan 03
1
S4 default initialization: unwanted NULL
The default initialization for slots of class "factor" and
"data.frame" gives NULL. This seems odd, since those slots can't ever
be set to NULL by the user. I would expect zero-length instances of
factor and data.frame.
Here is an example:
setClass("FOO", representation(a="factor", b="data.frame", c="numeric"))
[1] "FOO"
2006 Oct 15
1
Feature request: names(someEnv) same as ls(someEnv)
Hi,
I would be nice if names() returned the equivalent of ls() for
environments.
--- a/src/main/attrib.c
+++ b/src/main/attrib.c
@@ -687,6 +687,8 @@ SEXP attribute_hidden do_names(SEXP call
s = CAR(args);
if (isVector(s) || isList(s) || isLanguage(s))
return getAttrib(s, R_NamesSymbol);
+ if (isEnvironment(s))
+ return R_lsInternal(s, 0);
return R_NilValue;
}
2003 Feb 19
3
Pretty onscreen plots?
I'm looking for ideas for creating high-quality plots for use in projected
presentations (powerpoint, etc) --- ideally high-quality png, jpg, bmp.
The graphics produced using the postscript device look very good. Those
generated with win.graph(), png are plagued by the jaggy lines.
So far, the only way I can use the postscript plots in my presentations is
using separate screen capture