similar to: changes in r-devel for S3/S4 objects

Displaying 20 results from an estimated 8000 matches similar to: "changes in r-devel for S3/S4 objects"

2004 Aug 25
0
S3 classes in S4 class definitions
One of the changes some packages are noticing from the recent modifications to methods is warnings of "undefined classes" during installation when the package extends S3 classes or uses them as slots UNLESSS they have been declared in a setOldClass() call. The green book "strongly recommends" declaring S3 classs this way (pp 449-451). The warnings on undeclared classes
2009 Dec 15
1
S4 dispatch and S3 "connection" objects
Hello, I'm trying to get S4 dispatch on S3 "connection" objects. So I do : setOldClass( "connection" ) and then : setGeneric( "bling", function(object) standardGeneric( "bling" ) ) setMethod( "bling", "connection", function(object) cat( "gotcha ", as.integer(object), "\n" ) ) but I get : f <- file(
2009 Sep 15
2
S3 objects in S4 slots
Hello, I am the maintainer of the stringkernels package and have come across a problem with using S3 objects in my S4 classes. Specifically, I have an S4 class with a slot that takes a text corpus as a list of character vectors. tm (version 0.5) saves corpora as lists with a class attribute of c("VCorpus", "Corpus", "list"). I don't actually need the
2008 Jul 28
0
S4 classes that extend S3 classes
Up to now, writing an S4 class that extends an S3 class (using contains= in the call to setClass) has been discouraged for two main reasons: 1. You can't say anything formal about S3 classes, so validating objects, having formal slots for their properties, etc. are not generally feasible. 2. In any case, the S3 class, which may have multiple strings in the class attribute, was not
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members, Is there a way to test whether an object is an S4 object? The best that I've been able to come up with is isS4object <- function(object) !(is.null(slotNames(object))) which assumes that an S4 object has at least one slot. I think this is safe, but perhaps I'm missing something. Thanks, John -------------------------------- John Fox Department of
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members, Is there a way to test whether an object is an S4 object? The best that I've been able to come up with is isS4object <- function(object) !(is.null(slotNames(object))) which assumes that an S4 object has at least one slot. I think this is safe, but perhaps I'm missing something. Thanks, John -------------------------------- John Fox Department of
2007 Jan 24
1
how to properly extend s3 data.frames with s4 classes?
Dear R Programmers! After some time of using R I decided to work through John Chambers book "Programming with Data" to learn what these S4 classes are all about and how they work in R. (I regret not having picked up this rather fine book earlier!) I know from the documentation and the mailing archives that S4 in R is not 100% the book and that there are issues especially with
2012 Dec 12
1
Lost in S4 and S3 classes
Hi all, this is my first post in R devel? sorry if I lost some of the guidelines. Anyway this is my problem: Version: R version 2.15.2 (2012-10-26) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) I want to make an S4 class that use the output object of the function of nls.lm as a slot: setOldClass("nls.lm") setClass ( Class="TestClass",
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"),
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
2002 Jul 02
0
Changes to the methods package
A new version was checked in to r-devel today. These are the main changes: 1. Objects from the methods package are no longer copied into base. As a result, the behavior of data.class and all.equal should be the same whether methods are attached or not. (The methods package no longer uses data.class.) Also, detaching the methods package should restore the behavior of class() to the S3
2010 Jun 13
1
S4 classes and S3 generic functions
A general goal for the next version of R is to make S4 and S3 play better together. As mentioned in a previous thread, one limitation has been that S3 generic functions, specifically the UseMethod() call, did not make use of S4 inheritance when dispatching on general S4 objects. This has been fixed in a version committed today (updated to rev 52267). The code change is not large, but it
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
Answering to convey the 'rules' as I know them, rather than to address the underlying issues that I guess you are really after... The S4 practice is to use setOldClass() to explicitly treat an S3 character() vector of classes as an assertion of linear inheritance > x <- structure (sqrt (37), class = c ("sqrt.prime", "numeric") ) > is(x,
2002 Sep 10
0
Old-style classes: bug fix & request
Bug fix: A bug introduced in version 1.6 failed to "initialize" some old-style (aka "S3") classes, producing possible warning messages if those classes were used in the signature of a method in the methods package. The real bug, though, was that old-style inheritance could not be included, until the setOldClass function was provided. Initializing the methods package now
2015 May 28
0
S4 inheritance and old class
On 05/28/2015 02:49 AM, Julien Id? wrote: > Hey everyone, > > I would like to develop a package using S4 classes. > I have to define several S4 classes that inherits from each others as > follow: > > # A <- B <- C <- D > > I also would like to define .DollarNames methods for these class so, if I > have understood well, I also have to define an old class as
2008 Sep 09
1
building a package that contains S4 classes and methods
Hello R users, I am trying to make a my first package and I get an error that I can understand. The package is build out of three files (one for functions, 1 for s4 classes and 1 for s4 methods). Once I source them I run package.skeleton( name="TDC" ) within a R session and I get Creating directories ... Creating DESCRIPTION ... Creating Read-and-delete-me ... Saving functions and
2008 Oct 13
0
Version information for S4 classes --- elementary version management
Hi, we are about to update some class definitions in our distrXXX family of packages, so I would be eager to know whether there are plans in R Core to implement some version management tools for S4 classes as described in section 7.4 in JMC's "Green Book". In his recent book (continuing the color scheme, is it to be called the "Yellow Book"? :-), this topic has not been
2009 Oct 22
1
S4 object??
Hi all,   I have loaded the LIMMA and Biobase package and tried these commands:   library(limma) library("Biobase") data <- read.table("c:/temp/data.txt",header=T,row.names=1) ExpressionData <- as.matrix(data[,c(2,3,4,6,7,8)]) eset <- new("ExpressionSet", exprs = ExpressionData) design <- cbind(WT=1,P=c(0,1,1,0,1,1),G=c(0,1,0,0,1,0)) fit <-
2018 May 24
1
Creating S3 methods for S4 classes (coming from r-package-devel)
On Thu, May 24, 2018 at 6:20 PM, Michael Lawrence <lawrence.michael at gene.com > wrote: > You only have to make an S4 method if there is already an S4 generic. > If there is just an S3 generic, then just define S3 methods on it. I was refering to the recommendations in ?Methods_for_S3 ( https://stat.ethz.ch/R-manual/R-devel/library/methods/html/Methods_for_S3.html). : "Two
2005 Aug 11
1
Registering S3 class from external package
The package I'm working on can extract data from external packages but would otherwise have no dependency on them. However, I desire to be able to dispatch based on an external S3 class if its package is attached (.First.lib). My code is S4-based and its package has NAMESPACE. Registering the external class prior to the other package being attached doesn't seem to work so I am attempting