similar to: methods for @ operator

Displaying 20 results from an estimated 6000 matches similar to: "methods for @ operator"

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")
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'
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
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
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.
2011 Nov 09
1
Define S4 methods for 'plot'
Hi the list I am creating a package and I have a problem to define a S4 method for plot. I define a class 'A' and a class 'B'. I want to define a function plot for signature c(A,missing) and another method plot for signature c(A,B). My code is the following : In /package/R/ directory: --- main.R --- setGeneric("plot",function(x,y,...){standardGeneric("plot")})
2014 Nov 25
0
problem with setGroupGeneric from package methods
Hi, There seems to be a problem with setGroupGeneric() from package 'methods'. The symptoms are somewhat erratic, in the sense that small changes may lead to any of the following behaviours. 1.Package works without problems on Windows and installs on Linux but gives error when loaded with library(). 2.Package installs on both systems and gives error when loaded on any of them. 3.
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
2006 Sep 23
1
generics for primitive functions
i think these two code snippets exhibit a bug. they are identical but for the inclusion of an initial line in snippet [2] [1] setMethod("Math", signature(x = "numeric"), function(x) "Works") getGeneric("sqrt")(4) [2] getGeneric("sqrt")(4) setMethod("Math", signature(x = "numeric"), function(x) "Works")
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
2011 Nov 02
1
Writing new methods for `names<-`
Hi there, I'm working with an object whose internal data representation is very different from a data.frame (data is stored as a list of big.matrix objects from the bigmemory package) but to which I'd like to give users data.frame-like access. I've implemented names very easily as follows: setMethod("names", signature = "my.dataset", definition = function (x) {
2010 Oct 26
1
S4 methods for rbind()
Hello. I am trying to write an S4 method for rbind(). I have a class of objects called 'mdm', and I want to be able to rbind() them to one another. I do not want the method for rbind() to coerce anything to an mdm object. I want rbind(x1,x2,x1,x2) to work as expected [ie rbind() should take any number of arguments]. This is what I have so far: setGeneric(".rbind_pair",
2008 Nov 25
2
dots methods: dispatch issues
There seems to be a bug arising when using multiple S4 generics with "..." as the signature. The following code works as expected: ############################################################## > setGeneric("rbind", function(..., deparse.level=1) standardGeneric("rbind"), + signature = "...") Creating a generic for "rbind" in
2009 Jun 05
2
Problem with generic methods
Hi I want to create a new generic method, but I end up with an error (evaluation nested too deeply). see the transcript below. The function beginYear.Fun() works, but not beginYear. I have no idea why. Any ideas welcome, Rainer > setClass("fun", representation(x = "numeric")) [1] "fun" > new("fun") An object of class ?fun? Slot "x":
2005 Mar 25
1
S4 methods semantics questions
Some quick questions about S4 methods. Does the typing of S4 methods mean that lazy evaluation is no longer possible? It seems that you would need to evaluate the arguments to determine their type at dispatch. Second, what role, if any, do default arguments play in S4 methods? I notice that you can put default arguments into generics but that the dispatch is still done on the type of the
2010 Jul 21
1
Bug: broken exception handling in S4 methods
Hi all: we have noticed for quite a while that certain errors cannot be handled by R try, tryCatch etc blocks, but it was fairly difficult to understand what were the conditions for this incorrect behaviour. Finally I stabbed across a very understandable case, which is outlined in the (runnable) example below. The main message is: wrapping an S4 method call in a try block will not help if an
2006 Dec 01
2
promptClass misses methods
I've had repeated problems with promptClass missing methods, usually telling me a class has no methods when it does. In my current case, I've defined an S4 class "mspathCoefficients" with a print method setMethod("print", signature(x="mspathCoefficients"), function(x, ...) { # etc The file promptClass creates has no methods in it. >
2004 Jun 19
0
setGeneric / standardGeneric when args are not "literals" - corrected
This is a correction to my previous message, I forgot to swap two lines in the body of setMakeGenericMethod. Sorry about that. The correct (full message) reads like this: Hi, This works > setGeneric("clear", function(obj) standardGeneric("clear")) [1] "clear" but this doesn't. Why? > funName <- "clear" > setGeneric(funName,
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",
2011 Aug 03
1
NAMESPACE problems
Hi. I am having difficulty following section 1.6.6 of the R-extensions manual. I am trying to update the Brobdingnag package to include a NAMESPACE file (the untb package requires the Brobdingnag package). Without the NAMESPACE file, the package passes R CMD check cleanly. However, if I include a NAMESPACE file, even an empty one, R CMD check gives the following error in 00install.out: