Displaying 20 results from an estimated 1000 matches similar to: "generics for primitive functions"
2006 Sep 27
1
potential setClass bug (with user-defined environment)
the following returns an error in an 'exists' call on my machine
MyEnv <- new.env()
setClass("Numeric", "numeric", where=MyEnv)
franklin parlamis
> version
_
platform powerpc-apple-darwin8.7.0
arch powerpc
os darwin8.7.0
system powerpc, darwin8.7.0
status beta
major 2
minor 4.0
year
2006 Oct 11
1
dispatching on group generics with more than one formal
please see the code below. foo2 fails to dispatch correctly, but foo
does fine. i have tried 'cacheMetaData(1)' and a number of different
variants of 'cacheGenericsMetaData', on the possibility there is a
caching issue. but i still can't sort it out.
also one general question: does it really matter what's in the body
of the function definition in a
2006 Oct 06
1
class unions?
the code below has me confused:
setClassUnion("index", c("numeric", "character", "logical"))
extends("numeric") # i don't see the class union
library(Matrix)
extends("numeric") # now i see the class union
i am aware that the "Matrix" package separately defines the "index"
class union.
is it the case that
2006 Sep 20
1
residual '*tmp*' variable after "[<-" error
self-sanity check prior to filing a bug report:
attempted replacement that generates an error leaves a '*tmp*'
variable in the global environment.
test <- 1:10
test[2:4] <- expression(e)
ls()
i've read section 3.4.4 of the "R Language Definition" which
discusses the mechanism for replacement, and it is not clear to me
whether this was intended, but i suspect
2009 Nov 25
1
group generics
I have classes A and B, where B contains A. In the implementation of
the group generic for B I would like to use the corresponding group
generic for A. Is there a way to do that?
I would also appreciate any comments if what I'm trying to do seems like
the wrong approach.
Here's a stripped down example:
setClass("A",
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2007 Jan 31
2
Problems with definitions of S4-generics
Hello all,
I'd like to report a problem related to S4 classes.
Platform:
Mac G4/400 PCI (PPC-architecture)
Mac OS 10.4.8
R 2.4.1 for Mac OS X (CRAN binary, 2006-12-19) w/ R.app 1.18
Last December, Simon Urbanek confirmed that the issue is not platform
related, and that it is most likely a bug. He suggested to post my report
to "the appropriate mailing list" -- I choose r-devel.
2006 Oct 19
1
default arguments in generics and methods
i believe the following is true but would appreciate confirmation
that it is intended behavior and will continue:
if a default argument is employed in the definition of a generic
function, and the generic is called with the argument in question
(call it 'ARG') missing, then the method for signature (..., ARG =
"missing", ...) will be called by 'standardGeneric'
2006 Dec 18
2
write() gotcha
Hi
I used write() the other day to save some results.
It seems that write() does not record the full precision of
the objects being written:
> write(pi,file="~/f",ncolumns=1)
> pi.saved <- scan("~/f")
Read 1 item
> dput(pi)
3.14159265358979
> dput(pi.saved)
3.141593
> pi-pi.saved
[1] -3.464102e-07
>
This difficulty was particularly difficult to
2005 Dec 29
1
trouble with S4 methods for group "Summary"
Hello. This question concerns the Methods package. I have created a
new class and am trying to set a method for it for S4 group generic
"Summary". I have run into some signature problems. An example:
> setClass("track", representation(x="numeric", y="character"))
[1] "track"
> setGeneric("max", group="Summary")
2007 Mar 19
1
Again...
Newbie trying to install wine in his Mac OSX, getting the old annoying
message,
home:~/Desktop/wine G3$ /Users/G3/Desktop/wine/tools/wineinstall
WINE Installer v0.75
Running configure...
configure: creating cache config.cache
checking build system type... powerpc-apple-darwin8.7.0
checking host system type... powerpc-apple-darwin8.7.0
checking whether make sets $(MAKE)... no
checking for gcc...
2006 Sep 22
1
Possible bug in base::namespaceImportFrom?
Hi,
namespaceImportFrom in base/R/namespace.R has the following:
fdef <- methods:::getGeneric(genName, impenv)
The definition of getGeneric is in methods/R/RMethodUtils.R starts
with:
getGeneric <-
## return the definition of the function named f as a generic.
##
## If there is no definition, throws an error or returns
## NULL according to the value of
2006 Jul 11
1
invalid alignment error in R-2.4.0
Hi
I thought I'd pass one of my package through R CMD check with R-2.4.0
with the following result (it's clean under R-2.3.1):
[snip]
>
> # histogram of the fourth power:
> hist(out^4, col="gray")
*** caught bus error ***
address 0x12, cause 'invalid alignment'
Traceback:
1: sort(x, partial = c(half, half + 1))
2: sum(sort(x, partial = c(half, half +
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2016 Mar 04
2
as.vector in R-devel loaded 3/3/2016
I see as below, where getGeneric and getMethod imply a different signature; the signature is mode="any" for both cases in R version 3.2.3 Patched (2016-01-28 r70038)I don't know how to reproduce Jeff's error, though.
> library(Matrix)
> as.vector
function (x, mode = "any")
.Internal(as.vector(x, mode))
<bytecode: 0xe79f88>
<environment:
2003 Oct 13
2
Infinite recursion in getGeneric (PR#4561)
> setClass('foo')
[1] "foo"
> setMethod('is.logical', 'foo', function(x) TRUE)
[1] "is.logical"
> getGeneric('is.integer')
Error in options(x) : evaluation is nested too deeply: infinite
recursion?
>
--please do not edit the information below--
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system =
2006 May 02
0
methods for @ operator
i often find myself having a list of similarly-classed S4 objects and
needing a list containing a particular extracted slot from those
objects. so i did the following:
> setMethod("slot", signature(object = "list"),
+ function(object, name)
+ lapply(object, function(i) slot(i, name)))
Creating a new generic function for 'slot' in '.GlobalEnv'
[1]
2001 Nov 13
0
Method dispatch in C for primitive functions
There is a version of the methods package committed today that does
dispatch in C for these functions. This should considerably speed up
programs that define methods for these functions (specifically, having
methods should only marginally affect the existing computations for the
same function on basic vectors and objects).
This is the first of several steps needed. Not quite all primitives are
2008 Mar 26
0
as.POSIXct/as.POSIXlt generics
Hi,
I am trying to define the as.POSIXct as an S4 method for one of my
classes. Trying to define a generic, I am getting an error that it is
already differently defined in base. However, if I query for it, there
is no definition. Being in base, I also cannot really import it. If I
define methods without definig a generic, they will work but with a
warning that a new generic will be automatically