Displaying 20 results from an estimated 4000 matches similar to: "S3 classes in S4 class definitions"
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
2008 Nov 26
1
S4 slot containing either aov or NULL
Dear listmembers,
I would like to define a class with a slot that takes either an object
of class aov or NULL. I have been reading "S4 Classes in 15 pages more
or less" and "Lecture: S4 classes and methods"
#First I tried with list and NULL
setClass(listOrNULL")
setIs("list", "listOrNULL")
setIs("NULL", "listOrNULL")
#doesn't
2005 May 20
1
Problem with proj
Hi all,
Perhaps this in an inappropriate post, but I've found a bug in proj
I'd like to track down a bit further before making a formal bug report.
The example below shows the problem, if you change the rownames proj
fails. The problem seems to be that there is a mismatch in the rownames
in the qr objects constructed by aov and the rownames that proj is
expecting them to have.
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
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(
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",
2006 Feb 20
0
changes in r-devel for S3/S4 objects
Two recent changes have been committed to r-devel, related to
discussions on this list earlier:
1. setOldClass() has an argument prototype= to specify the default
object for the class. If provided, the S3 class can be a slot in an S4
class, with a valid default object.
(It's still not going to work well to have an S3 non-virtual class as a
superclass of an S4 class. See the
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
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
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
2002 Aug 28
0
Fixes/additions to methods package
Some changes committed today to the r-devel (1.6.0) version of the
methods package:
1. The function setOldClass has been added as per the green book, p.
450. The point in this case is not conversion as in the green book so
much as allowing old-style classes to be included in signatures given to
setMethod.
This worked before (with a warning), but old-style inheritance couldn't
be picked up.
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
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
2013 Jan 17
3
Colors in interaction plots
Hi,
I am trying to plot an interaction.plot with different color for each
level of a factor. It has an erratic behavior.
For example, it works for the first interaction.plot below, with the
example from the ALDA book, but not with the other plots, from the NPK
dataset:
# from http://www.ats.ucla.edu/stat/r/examples/alda/ch2.htm
tolerance <-
2010 Apr 21
1
How to obtain the coefficients from a summary of aov ?
Dear Madame, Dear Sir,
I am able to obtain the coefficients from a 'summary' of 'lm', but NOT from a 'summary' of 'aov'.
The following example shows my steps.
## Initialize
rm(list = ls()) # remove (almost) everything in the working environment
utils::data(npk, package="MASS") # get data
model <- yield ~ block + N*P*K
## Using lm
npk.lm <-
2003 Jul 24
0
Revisions of the S4 classes software + ?Documentation
Some changes to the implementation of S4 classes in the methods package
will be committed to the r-devel version, probably later today. They
should be largely back-compatible (exception noted below) but they are
fairly extensive, so this is an advance notice.
The changes form the first of a two-stage change aimed at making the
implementation more consistent with R semantics, in particular with
2003 Jan 24
1
model.tables and NA?
Hi,
This might be a minor bug, or it could be that I'm just mis-using the tools
(again).
If you modify the example for model.tables to introduce an NA,
N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
yield <-
2003 Apr 17
2
make check failure with R-1.7.0
I'm baffled. When I run make check after installing from source, I
get a Error 2. From my understanding of how these things work, it
would appear to be coming from this (as at the end of base-Ex.Rout.fail:
> has.VR <- require(MASS, quietly = TRUE)
Attaching package 'MASS':
The following object(s) are masked from package:base :
confint confint.lm nclass.FD nclass.scott