Displaying 20 results from an estimated 5000 matches similar to: "Documenting generic S4 replacement method for package building"
2003 Aug 21
2
efficiency and memory use of S4 data objects
I do lots of analyses on large microarray data sets so memory use and speed
and both important issues for me. I have been trying to estimate the
overheads associated with using formal S4 data objects instead of ordinary
lists for large data objects. In some simple experiments (using R 1.7.1 in
Windows 2000) with large but simple objects it seems that giving a data
object a formal class
2009 Oct 27
1
How to reduce key strokes when defining S4 classes?
I feel tedious when I define a S4 class and the methods. For each
method, I have to call both setMethod and setGeneric (or both
setReplaceMethod and setGeneric). I would like a more compact grammar
so that I can reduce the key strokes. I'm wondering if there is a
better way available.
setClass(
Class='A',
representation=representation(
x='numeric'
)
2004 Sep 03
0
Changing the value of an object's slot in a method
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Received-SPF: none (hypatia: domain of tofesi at web.de does not designate permitted sender hosts)
X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on hypatia.math.ethz.ch
X-Spam-Level:
X-Spam-Status: No, hits=0.2 required=5.0
2010 May 12
1
slot assignment in S4 classes
Hi R friends,
I'm still studying S4 classes and I have a question about slot assignment. Why would I have to use a special setter method [example 2 below] if I can assign data to a slot directly when I call new() [example 1 below]?
## first way to do it (the idiosyncratic way?)
setClass(Class = "TestClass", representation = representation(myDf = "data.frame"))
2014 Jan 07
1
Why do methods of "initialize" have no "srcref" attribute as other S4 mehtods?
For documentation we use a system that generates Rd files from special
comments in the code. (inlinedocs).
It is crucial to be able to get the defining source code for objects like
methods to extract the comments from it.
Here is an R session that shows how this works for several kinds of methods
and (at the end of the session) how if fails for methods of "initialize"
>
2013 Jan 30
0
ROxygen2-Documenting of S4 Method
Hi all,
I'm trying to come to grips with how to document S4 methods using ROxygen -
mostly following posts such as this: http://tinyurl.com/ae3kdno
I just can't get it to work (this is roxygen2_2.2.2).
I attach an example below which seems parsed properly, but "R CMD check"
keeps complaining
> ...
> Undocumented S4 methods:
> ...
> generic 'set<-' and
2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all,
Assume that I have an S4 class "MyClass" with a slot "myname", which
is initialized to: myname="" in method("initialize"):
myclass <- new("MyClass", myname="")
Assume that class "MyClass" has a method "mymethod":
"mymethod.MyClass" <-
function(object, myname=character(0), ...) {
2017 Sep 22
2
S4 method implementation for S3 class
Hi all,
I'm trying to implement the matrix multiplication operator, which is
S4 generic, for an old-style S3 class. The following works as
expected:
x <- 1:10
class(x) <- "myClass"
setOldClass("myClass")
setGeneric("myMethod", function(x, y) standardGeneric("myMethod"))
setMethod("myMethod", c("myClass", "myClass"),
2007 May 25
1
Question about setReplaceMethod
Hi
I have the code like I show below. The problem here is that I have a setReplacementMethod to set the value of my class slot. However, this function doesn't work when I call it within another function definition (declared by setMethod) of the same class. I do not understand this behavior that much. I'm wondering how to make this work? Any help would be really appreciated. Thank you.
2017 Sep 22
0
S4 method implementation for S3 class
The %*% function is a primitive. As it says in the documentation under
?Methods_Details
Methods may be defined for most primitives, and corresponding
metadata objects will be created to store them. Calls to the
primitive still go directly to the C code, which will sometimes
check for applicable methods. The definition of ?sometimes? is
that methods must have been detected
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi,
I recognized that the function 'setReplaceMethod' is creating a
character vector in the user workspace having the name (e.g. "newClass")
of the class used as value. If you can sort out a mistake by myself, I
would like you to file a bug report.
BBFN,
Jonathan
setClass("newClass", representation(value="numeric"))
setMethod(f = "initialize",
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi,
I recognized that the function 'setReplaceMethod' is creating a
character vector in the user workspace having the name (e.g. "newClass")
of the class used as value. If you can sort out a mistake by myself, I
would like you to file a bug report.
BBFN,
Jonathan
setClass("newClass", representation(value="numeric"))
setMethod(f = "initialize",
2017 Jun 27
0
[Rd] setReplaceMethod creates 'object' in the userworkspace
>>>>> Jonathan Fritzemeier <clausjonathan.fritzemeier at uni-duesseldorf.de>
>>>>> on Fri, 23 Jun 2017 16:15:30 +0200 writes:
> Hi,
> I recognized that the function 'setReplaceMethod' is creating a
> character vector in the user workspace having the name (e.g. "newClass")
> of the class used as value. If you can
2011 Sep 14
1
S4 method dispatch
List,
In order to get rid of some old, unreadable S3 code in package sp, I'm
trying to rewrite things using S4 methods. Somewhere I fail, and I
cannot sort out why. In order to isolate the problem, I created two
functions, doNothing<- and dosth, and both should do nothing. The issue
is that in most cases they do nothing, but in some cases dosth(obj)
changes the class of obj and breaks with
2007 Dec 23
1
Problem with initialize of S4 classes
Dear all
Below is the code for "scriptPreFilter.R" which gives the following result:
> source("scriptPreFilter.R")
> prefltr <- new("PreFilter", mad=c(0.5,0.01))
[1] "------initialize:PreFilter------"
[1] "------initialize:Filter------"
> str(prefltr)
Formal class 'PreFilter' [package ".GlobalEnv"] with 2 slots
2009 Nov 09
1
\\signature macro generated by promptMethods
Hello,
promptMethods generate a macro for signatures, but the macro does not
exist in the Rd parser.
> setClass("track",
+ representation(x="numeric", y="numeric"))
[1] "track"
> setGeneric("foo", function(x){ standardGeneric("foo") } )
[1] "foo"
> setMethod( "foo", "track",
2009 Sep 17
1
package documentation of S4 methods
Hi,
I'm new to this mailing list and to R-programming so if the question is stupid I apologize.
I have to create a package, which includes an S4-class called "BList". For objects of this class I implemented a method "show", which displays the first 15 data-lines of the object. I further implemented a method "showall", which displays the whole data in the object.
2005 Jun 02
1
showMethods doubt
Hi,
I'm developing in S4 and I wanted to see the methods for a specific
class using showMethods but I didn't succed. Can someone help ? See the
example below.
setClass("myclass",
representation(
name ="character"
)
)
setGeneric("mymeth", function(obj, ...){
standardGeneric("mymeth")
}
)
setMethod("mymeth",
2008 Sep 11
0
creating a package with internal (hiden) S4 classes and methods
Dear R users,
I am writing my first R package and it finally past the R CMD check.
Before sending it to CRAN, I would like to check a few issues.
1. I created s4 classes and methods in the package but I want only 1
function (foo) to be available to users and documented in the manual
that goes with the package. I put foo in 1 file and the rest (internal
functions, classes and methods) in a
2004 Nov 11
1
"<<-" assignment no long work in class methods
Hi-
I used to use "<<-" to do assignment inside a class method, and
just found that now it is broken in R 2.0. For example, the
following code
-----------------------------------------------------------------------
setClass( "myclass", representation(x="numeric") )
setGeneric("incrXByOne", function(obj) standardGeneric("incrXByOne"))