similar to: another S4 question ...

Displaying 20 results from an estimated 20000 matches similar to: "another S4 question ..."

2008 Jul 25
1
S4 class and Package NAMESPACE [NC]
Hello, I am trying to make a R package with S4 classes. To do so, i do as usual (when no S4 were involved, i.e without NAMESPACE file) and I've got errors in class refering to other classes in the package. So I use a NAMESPACE file to declare classes, it works fine, but now I have to declare each functions in the NAMESPACE file. Since I have a lot of functions, it's not very easy.
2010 Aug 15
2
adding a built-in drop.levels option for subset() in 2.12 ?
With the approach of R 2.12.0: with mild apologies for re-opening this perennial issue: is there any hope, if appropriate patches are submitted, of adding a drop.levels argument (with default equal to FALSE to preserve backward compatibility/efficiency) to the subset function ... ? If not, would a patch to the documentation and/or the R FAQ be accepted? This does seem to be a continuing
2009 Feb 25
1
S4 helper functions: regular or generic?
Hi there, I want to write helper functions for a base class, which will be used by its subclasses in the S4 world. This function ___will___ update certain slots of its argument object. Please help me decide which one of the following is a better approach with respect to coding style, memory usage and speed: o Write a regular function. o Declare a generic and implement it just for the base
2008 Mar 20
1
S4 : package creation
Hi the list, Using S4, how can we create a package? In "S4 Classes in 15 pages, more or less", they put all the classes definition in a function that will be called at the opening of the library and they add "by hand" a Rd file. Is it the only way ? Is there something like "S4.package.skeleton"? Thanks Christophe
2009 Jan 19
1
pass by reference for S4
Hi all; Is it possible to modify the "@" operator that it can handle references (or external pointers) of S4 Object instead of the real Objects? Or is there any technical or compatibility issue which make it impossible? I look forward to hear from you and also hope that you don't hate me for my nooby question. Yours sincerely, Rudolf Biczok [[alternative
2006 Dec 16
2
question about trailing arguments in an S4 method
I'm trying to add arguments to the AIC method for some classes -- things like weights=TRUE to calculate AIC weights corr=TRUE, nobs to calculate AICc delta=TRUE to put a delta-AIC column in the output. The problem is that AIC is defined as AIC(object, ..., k=2) where k is the constant associated with the penalty term and ... is a list of objects that will have their AICs calculated
2008 Jul 10
1
S4 class questions
Hi, I'd like to create a S4 class contains only one type of data. However, the number of slots varies. For example, I want to create a class "a", each slots in "a" contains numeric value only. > setClass("a", contains = "numeric") If I want to create an object "a" with only one slot containing c(3,4), I will write >
2008 Feb 29
1
inheritence in S4
Hi the list I define a class A (slot a and b), a class C (slot c and d) and a class E that inherit from A and B. I define print(A) and print(B). For print(C), I would like to use both of them, but I do not see how... Thanks for your help... Christophe ---------------------------------------------------------------- Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
2008 Feb 08
2
learning S4
Hi the list. I try to learn the S4 programming. I find the wiki and several doc. But I still have few questions... 1. To define 'representation', we can use two syntax : - representation=list(temps = 'numeric',traj = 'matrix') - representation(temps = 'numeric',traj = 'matrix') Is there any difference ? 2. 'validityMethod' check the
2007 Dec 13
1
S4 class extending data.frame?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I would like to build an S4 class that extends a data frame, but includes several more slots. Here's an example using integer as the base class instead: setClass("c1",representation(comment="character"),contains="integer") z1 = new("c1",55,comment="hello") z1 z1+10 z1[1] z1 at comment -- in
2012 Feb 26
1
improved error message when existing implicit S4 generic is not imported?
pkgA's NAMESPACE has importFrom(graphics, plot) exportClasses("A") exportMethods("plot") R/foo.R has setClass("A") setMethod("plot", "A", function(x, y, ...) {}) During R CMD INSTALL pkgA_1.0.tar.gz we are told ** preparing package for lazy loading Creating a generic function for 'plot' from package
2008 Jun 19
2
S4 pass-by-value work-around?
Howdy all, I have a problem that I'd like some advice/help in solving---it has to do with R's pass-by-value system. I understand the issue, but am wondering if anyone has found a working solution in dealing with it for cases when one wants to modify an object inside of a method, specifically when working with S4. I'm aware that R.oo is able to deal with this using S3, but I'd
2008 Aug 27
1
S4 coercion
I am extending a DBI connection by setClass("TSPostgreSQLConnection", contains=c("PostgreSQLConnection","TSdbOptions")) but the first time I use this I am getting a warning when it tries to coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the first use the warning stops, but the first warning is causing me problems when I do automatic checks
2012 Jul 30
1
confusion over S3/S4 importing
Can anyone help me figure out the right way to import a method that is defined as S3 in one package and S4 in another? Specifically: profile() is defined as an S3 method in the stats package: function (fitted, ...) UseMethod("profile") <bytecode: 0xa4cd6e8> <environment: namespace:stats> In stats4 it is defined as an S4 method: stats4:::profile standardGeneric for
2008 Feb 29
1
Problems initializing an extended S4 class
Hi all, I am having trouble extending S4 classes in cases where I'm using both validity and initialize methods. I've read as much S4 information as I can find, but I've yet to have that "a-ha" moment. In my application, I am using validity methods to guard against inappropriate input data that my code has no way of handling, and initialize methods to detect and deal
2008 May 23
1
seeing an S4 method, not using it
Dear list, here is a problem I met when trying to use a method for an S4 object, without loading the package in which the method was defined. I do not know if this is a bug, or a mistake of mine. Normally, I think the package in which the appropriate method is defined is loaded automatically when calling the method. The problem is that if the package is indeed loaded automatically, the
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
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries (Python lingua) as S4 classes, see the coding below. I came across some rough S4 edges, but in the end it worked (for one dictionary). When testing ones sees that the dictionaries D1 and D2 share their environments D1 at hash and D2 at hash, though I thought a new and empty environment would be generated each time
2014 Jul 06
2
Depot for S3 to S4 generics (as in stats4)?
Dear developers, the implementation of S4 generics for existing S3 ones in the base package is concerned to be a threat to quick startup times [1]. But since S4 is promoted, and S3/S4 interoperability a pain when package developing [2], are there efforts to improve the situation? E.g. an S3 free system, etc. A good thing [2] is the package 'stats4', including some setGeneric calls (e.g.
2011 Mar 26
1
another import puzzle
Dear list, I have another (again possibly boneheaded) puzzle about importing, again encapsulated in a nearly trivial package. (The package is posted at <http://www.math.mcmaster.ca/bolker/misc/coefsumtest_0.001.tar.gz>.) The package consists (only) of the following S3 method definitions: coeftab <- function(object, ...) UseMethod("coeftab",object) coeftab.default <-