similar to: S4 issues

Displaying 20 results from an estimated 30000 matches similar to: "S4 issues"

2010 Feb 26
1
S4 programming
Dear all, I'm new to S4 classes and have a question on this. I want to use S4 because I want to define explicitly the slots that the new class can have. But other than that, the new class behaves exactly like a list. But this will not allow me to use the generic functions that are already defined for class "list", such as "$", "c", "[[",
2010 Sep 02
1
Help on glm and optim
Dear all, I'm trying to use the "optim" function to replicate the results from the "glm" using an example from the help page of "glm", but I could not get the "optim" function to work. Would you please point out where I did wrong? Thanks a lot. The following is the code: # Step 1: fit the glm clotting <- data.frame( u =
2010 Mar 01
1
Method dispatch
Dear all, In a package, I defined a method for "summary" using setMethod(summary, signature="abc") for my class "abc", but when the package is loaded, the function "summary(x)" where x is of class "abc" seems to have called the default summary function for "ANY" class. Shouldn't it call the method I have defined? How could I get
2011 May 16
4
Problem on glmer
Hi all, I was trying to fit a Gamma hierarchical model using "glmer", but got weird error message that I could not understand. On the other hand, a similar call to the glmmPQL leads to results that are close to what I expect. I also tried to change tha "nAGQ" argument in "glmer", but it did not solve the problem. The model I was fitting has a simple structure - one
2010 Sep 09
5
Help on simple problem with optim
Dear all, I ran into problems with the function "optim" when I tried to do an mle estimation of a simple lognormal regression. Some warning message poped up saying NANs have been produced in the optimization process. But I could not figure out which part of my code has caused this. I wonder if anybody would help. The code is in the following and the data is in the attachment. da <-
2009 Oct 19
1
Defining S3-methods for S4-objects: cannot coerce type 'S4' to vector of type 'integer'
In the 'doBy' package there is an esticon() function for calculating linear contrasts for various model types. I have defined an S3-method 'esticon.mer()' for 'mer' objects from the lme4 package. Building the package and invoking the method gives: > esticon(fm1, c(1,1)) Confidence interval ( WALD ) level = 0.95 Error in as.integer(x) : cannot coerce type 'S4'
2009 Jun 15
1
Create R object
Dear R users, I have two simple questions here, and hope someone can help me on this. Thanks in advance. 1. I have a list object lst=list(a1=matrix(rnorm(4),2,2), a2=matrix(rnorm(4),2,2),a3=matrix(rnorm(4),2,2)). Here I only use three elements for illustration, and in fact the length of lst, n, is unknown in advance. I want to define an object for each element of this lst, and the objects have
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
2004 Nov 18
1
Method dispatch S3/S4 through optimize()
I have been running into difficulties with dispatching on an S4 class defined in the SparseM package, when the method calls are inside a function passed as the f= argument to optimize() in functions in the spdep package. The S4 methods are typically defined as: setMethod("det","matrix.csr", function(x, ...) det(chol(x))^2) that is within setMethod() rather than by name before
2010 Mar 16
1
Problem with S3 to S4 transition
Hello to everybody I am developing a package using R and have the following problem: I used to work in a mixture of S3 and S4 mechanism environment: as a matter of fact, I used to define my classes (say "DB" for illustration) using the setClass function (with representation field), and I was using the S3 implicit mechanism writing the functions: print.DB and plot.DB. Recently, I
2005 May 23
1
SV: Documentation of S3 and S4 classes, inheritance
I am sure that I do not have the answer to your question - but I would like to add to your views regarding the S4-issue. I've been involved in the gRbase package for graphical modelling in R. The first version was implemented in S4 but now we have made a roll-back to using S3 methods. While, I can see that S3 is not really comprehensive enough for 'proper' object oriented
2017 Sep 22
0
S4 method implementation for S3 class
On Fri, Sep 22, 2017 at 10:28 AM, I?aki ?car <i.ucar86 at gmail.com> wrote: > 2017-09-22 19:04 GMT+02:00 Michael Lawrence <lawrence.michael at gene.com>: >> 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
2011 Sep 08
1
S4 - Upgrade options from S3
We've been running samba3 with an ldap backend for several years now in our company. We use a separate exchange server for email, requiring users to keep two separate passwords - one for the domain (samba) and one for exchange. I've been looking at samba4 for a while and am running a test server with it, built from the latest git source as per the howto description. We would be quite
2018 May 24
0
Creating S3 methods for S4 classes (coming from r-package-devel)
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 think we should stay away from defining S4 generics when there is no good reason for them. Good reasons include multiple dispatch, or a non-default signature. Neither of those apply in this case. Michael On Thu, May 24, 2018 at 6:39 AM, Joris Meys
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
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 Mar 18
1
Why S4 methods of S3 'base' generics are not used in 'base' functions ?
Dear list, It seems that S4 methods defined for an S3 'base' generic are not used in 'base' functions. This can be problematic when 'base' functions start with something like 'as.matrix'. ### START R code setClass("classA", contains = "matrix", representation(realData = "numeric")) setMethod("as.matrix",
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
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
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