Displaying 20 results from an estimated 10000 matches similar to: "Overriding S4 methods in an installed package"
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
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",
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
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 <-
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 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 May 08
2
Problem calling $ inside a $ method
Hello,
I wonder if this will make it through the spam filters given the
subject line.
I'm seeing the following when trying to call a dollar method inside of
a dollar method.
setClass("Foo", representation(d="list"))
[1] "Foo"
f <- new("Foo", d=list(bob=1, alice=2))
## We can call dollar at this level and it works as expected
2010 Jan 19
1
calling setGeneric() twice
Is it safe to call setGeneric twice, assuming some setMethod's for the
target function occur in between? By "safe" I mean that all the
setMethod's remain in effect, and the 2nd call is, effectively, a no-op.
?setGeneric says nothing explicit about this behavior that I can see.
It does say that if there is an existing implicity generic function it
will be (re?)used. I also tried
2010 Aug 13
2
64 bit RSQLite
Hi folks,
Ubuntu 10.04 64 bit
Where can I find 64 bit RSQLite?
It seems not there;
RSQLite: SQLite interface for R
http://cran.r-project.org/web/packages/RSQLite/index.html
TIA
B.R.
Stephen L
2008 Jun 04
2
RSQLite bug fix for install with icc
Seth,
I encountered problems installing RSQLite, R-2.7.0, on RHEL4 using
Intel 10.1 icc, My sysadmin helped me track down the problem and
kindly forwarded me the fix, which corrected the problem.
What follows is from the sysadmin. Mark
I looked at the error, looks like there is a bug in the source code.
I've attached a new tarball, hopefully fixed.
I added
#include <sys/types.h>
2009 Jan 29
4
Side-effects of require() vs library() on x86_64 aka amd64
RDieHarder fails its regression tests on x86_64 (aka "amd64") at CRAN (using
Debian), and I see the same on Ubuntu 8.10 in 64 bit. No issues on 32bit.
One odd thing is that the program behaves well if run via
R --no-save < tests/RDieHarder.R
but NOT when started using
R --slave < tests/RDieHarder.R
as R CMD check does.
So I tried different things related to startup
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))
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
2008 Jan 31
1
segfault in gregexpr()
Hi,
Tried with R 2.6 and R 2.7:
> gregexpr("", "abc", fixed=TRUE)
*** caught segfault ***
address 0x1c09000, cause 'memory not mapped'
Traceback:
1: gregexpr("", "abc", fixed = TRUE)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
2008 Feb 21
1
Suggestion: isLoaded() to test if a package is loaded (without loading it)
Hi,
for 'affxparser' (Bioconductor), we needed a function to test if a
certain package was loaded or not, but we did not want to load it if
it wasn't, which is why we couldn't use require(). We came up with
the following solution:
isPackageLoaded <- function(package, version=NULL, ...) {
s <- search();
if (is.null(version)) {
s <-
2007 Mar 04
1
Problem using callNextMethod() in S4
Dear all,
Maybe, I am doing something wrong, but using R-2.5.0 on my Intel-Mac, I
have problems
using function callNextMethod() in method initialize.
I am loading the following code as file "testS4.R":
setClass("baseClass",
representation(myname = "character",
mydir = "character",
"VIRTUAL"),
2007 Nov 14
1
isOpen on closed connections
As far as I can tell, 'isOpen' cannot return FALSE in the case when 'rw = ""'.
If the connection has already been closed by 'close' or some other function,
then isOpen will produce an error. The problem is that when isOpen calls
'getConnection', the connection cannot be found and 'getConnection' produces an
error. The check to see if it is
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",
2004 Oct 08
3
Bug with png() and plot(type="n") (PR#7270)
Full_Name: Allen McIntosh
Version: 2.0.0
OS: Linux
Submission from: (NULL) (67.80.175.118)
Observed the bug with the following combinations: (RedHat 7.3, R 1.6.0) (RedHat
7.3, R 1.9.1) (Redhat 9, R2.0.0).
In the second plot (.png file) produced by the following sequence:
png(file="x%d.png")
plot(1:10,1:10,main="ooo",type="n")
segments(1:9,1:9,2:10,1:9)