Displaying 14 results from an estimated 14 matches for "removegeneric".
2007 Jan 31
2
Problems with definitions of S4-generics
...t)
# {
# standardGeneric("foofunc")
# }
# <environment: 0x293bbb8>
# Methods may be defined for arguments: object
getGeneric("foofunc")
# same result as above
#### Now what I suspect is a bug
## Delete the S4-generic and repeat the "forensic" test calls
removeGeneric("foofunc")
# [1] TRUE
## The following is as expected...
foofunc
# Fehler: objekt "foofunc" nicht gefunden [~ Error: object "foofunc" not
found]
## Oops, but what's that?
getGeneric("foofunc")
# nonstandardGenericFunction for "foofunc" def...
2009 Oct 23
2
mysteriously persistent generic definition
...use the
argument of the new function definition.
<quote>
> args(yearStop)
function (obj)
NULL
> yearStop <- function(x) x at yearStop
> args(yearStop)
function (x)
NULL
> setGeneric("yearStop")
[1] "yearStop"
> args(yearStop)
function (obj)
NULL
> removeGeneric("yearStop")
[1] TRUE
> args(yearStop)
Error in args(yearStop) : object "yearStop" not found
> yearStop <- function(x) x at yearStop
> setGeneric("yearStop")
[1] "yearStop"
> args(yearStop)
function (obj)
NULL
</quote>
R 2.7.1. I origin...
2024 Mar 15
2
Spurious warning in as.data.frame.factor()
...s.data.frame) and keep going? (Or even keep the S4 generic?) Is
> there any hidden state I may be breaking for the rest of the test this
> way?
> The test does pass like this, so this may be worrying about nothing.
Indeed, this could be educational; I think just adding
removeGeneric('as.data.frame')
is appropriate here as it is self-explaining and should not leave
much traces.
I'm about to test this in reg-tests-1e.R and with make check-all
and commit later today,
thanking you, Ivan!
Martin
2013 Jul 02
2
cache most-recent dispatch
...80 21.27616 21.453174 21.833686 24.758791 10
## fun1(lst) 4.517808 4.53067 4.582641 4.682235 5.121856 10
Dispatch seems to be especially slow when packages are involved, e.g.,
with the Bioconductor IRanges package
(http://bioconductor.org/packages/release/bioc/html/IRanges.html)
removeGeneric("paste")
library(IRanges)
showMethods(paste)
## Function: paste (package BiocGenerics)
## ...="ANY"
## ...="Rle"
selectMethod(paste, "ANY")
## Method Definition (Class "derivedDefaultMethod"):
##
## function (..., sep = &q...
2007 Mar 29
0
S4 generic surprise
...;matrix", function(object) 40)
[1] "foo"
> foo(0)
[1] 2
# isGeneric is TRUE, but method lookup no longer works
# I think the cause is that the function foo that used
# to do the dispatch has been overwritten by my plain old
# function that returns 2.
> foo(matrix(0))
[1] 2
> removeGeneric("foo")
[1] FALSE
Warning message:
generic function "foo" not found for removal in: removeGeneric("foo")
> isGeneric("foo")
[1] TRUE
My mental model and R's diverged at the point I overwrote foo with a
regular function (foo <- function(object) 2)....
2008 Nov 25
2
dots methods: dispatch issues
...nd
standardGeneric for "rbind" defined from package ".GlobalEnv"
function (..., deparse.level = 1)
standardGeneric("rbind")
<environment: 0x83862f4>
Methods may be defined for arguments: ...
Use showMethods("rbind") for currently available ones.
> removeGeneric("rbind")
[1] TRUE
> rbind
function (..., deparse.level = 1)
.Internal(rbind(deparse.level, ...))
<environment: namespace:base>
> setGeneric("order", signature="...",
+ function (..., na.last=TRUE, decreasing=FALSE)
+ standardGeneric(&q...
2024 Mar 15
1
Spurious warning in as.data.frame.factor()
...ing? (Or even keep the S4 generic?) Is
>> there any hidden state I may be breaking for the rest of the test this
>> way?
>> The test does pass like this, so this may be worrying about nothing.
> Indeed, this could be educational; I think just adding
> removeGeneric('as.data.frame')
> is appropriate here as it is self-explaining and should not leave
> much traces.
> I'm about to test this in reg-tests-1e.R and with make check-all
> and commit later today,
> thanking you, Ivan!
This has been committed to R-devel...
2008 Mar 13
3
Sealed for setGeneric
Hi the list
When two setGeneric occurs on the same function, the second erage the
first and erase all the function previously define.
Is it possible to prevent that ? Is it possible to declare a setGeneric
that can not be erased later ?
Something like the |sealed for setMethod...|
||
|Thanks|
||
Christophe
2024 Mar 14
1
Spurious warning in as.data.frame.factor()
On Thu, 14 Mar 2024 10:41:54 +0100
Martin Maechler <maechler at stat.math.ethz.ch> wrote:
> Anybody trying S7 examples and see if they work w/o producing
> wrong warnings?
It looks like this is not applicable to S7. If I overwrite
as.data.frame with a newly created S7 generic, it fails to dispatch on
existing S3 classes:
new_generic('as.data.frame', 'x')(factor(1))
#
2019 Jun 29
2
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error
...:
-----------------------------------------------------------------------------
## conformMethod() "&& logic" bug, by Henrik Bengtsson on R-devel list, 2019-06-22
setClass("tilingFSet", slots = c(x = "numeric"))
if(!is.null(getGeneric("oligoFn"))) removeGeneric("oligoFn")
setGeneric("oligoFn",
function(object, subset, target, value) { standardGeneric("oligoFn") })
Sys.unsetenv("_R_CHECK_LENGTH_1_LOGIC2_") ## << added here, to compare with R 3.6.0, 3.5.3, ..
setMethod("oligoFn", signature(o...
2019 Jul 01
1
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true
...------------------------------------------------------
> ## conformMethod() "&& logic" bug, by Henrik Bengtsson on R-devel list, 2019-06-22
> setClass("tilingFSet", slots = c(x = "numeric"))
> if(!is.null(getGeneric("oligoFn"))) removeGeneric("oligoFn")
> setGeneric("oligoFn",
> function(object, subset, target, value) { standardGeneric("oligoFn") })
> Sys.unsetenv("_R_CHECK_LENGTH_1_LOGIC2_") ## << added here, to compare with R 3.6.0, 3.5.3, ..
> setMethod("o...
2019 Jun 29
0
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error
...------------------------------------------------------
> ## conformMethod() "&& logic" bug, by Henrik Bengtsson on R-devel list, 2019-06-22
> setClass("tilingFSet", slots = c(x = "numeric"))
> if(!is.null(getGeneric("oligoFn"))) removeGeneric("oligoFn")
> setGeneric("oligoFn",
> function(object, subset, target, value) { standardGeneric("oligoFn") })
> Sys.unsetenv("_R_CHECK_LENGTH_1_LOGIC2_") ## << added here, to compare with R 3.6.0, 3.5.3, ..
> setMethod("o...
2019 Jun 28
2
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error
> On 28 Jun 2019, at 16:03 , Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
>>>>>> Henrik Bengtsson
>>>>>> on Thu, 27 Jun 2019 16:00:39 -0700 writes:
>
>> Using:
>>
>> untrace(methods::conformMethod)
>> at <- c(12,4,3,2)
>> str(body(methods::conformMethod)[[at]])
>> ## language omittedSig
2003 Apr 24
2
R-1.7.0 build feedback: NetBSD 1.6 (PR#2837)
R-1.7.0 built on NetBSD 1.6, but the validation test suite failed:
Machinetype: Intel Pentium III (600 MHz); NetBSD 1.6 (GENERIC)
Remote gcc version: gcc (GCC) 3.2.2
Remote g++ version: g++ (GCC) 3.2.2
Configure environment: CC=gcc CXX=g++ LDFLAGS=-Wl,-rpath,/usr/local/lib
make[5]: Entering directory `/local/build/R-1.7.0/src/library'
>>> Building/Updating