similar to: S3 and S4 classes

Displaying 20 results from an estimated 7000 matches similar to: "S3 and S4 classes"

2003 May 19
3
how to run R as a daemon
Hi all, Using R a as a real-time application called by Php for a website, I would like to run one R process only, which would manage user connections. For the time each user who asks for an analysis causes a new R process to start, which is not suitable in prevision of many users. R needs about 30 seconds to run the script which makes the analysis. The problem is that this waiting time is n
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
2003 Nov 18
2
readline not found
Hi all, I just upgraded to R-1.8.0. Everything worked fine but command line editing does not work. This clearly indicates that readline has not been found in the compilation process. How could I explicitely indicate where to find it ? I use a Red Hat 8.0 system. I checked the FAQ which says readline-devel is also needed, but I have it already installed. Perhaps should I add the configure
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" >
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), ...) {
2011 Jun 06
1
Seeking help to define method for show() for an S4 object
Dear all, I have created a new S4 class with name "MyClass". Please see below for it's definition. Now I want to create a method for the show() function for this class. In defining this method, what I want is, once user would like see an object of this class some values will be displayed. Then R will ask for **press Enter**. Once user presses enter then, remaining values will be
2010 Oct 30
1
overloading "[" and "[<-" using S3 classes
How can I overload the "[" and "[<-" operators using S3 classes? Something like '['.{class} did not work or at least I do not know how to define it properly. For S4 it is straightforward: setMethod("[", signature(x = "myClass", i = "numeric"), function (x, i, j, ..., drop){ ... some operations }) How to do the same for S3? TIA!
2011 Feb 01
1
Help need to define method of an s4 class
I need some help in defining a "print" method for my new S4 class definition. So fer I have worked like this: setClass("MyClass", sealed=F, representation(slot1 = "list", #create a new class slot2 = "vector", slot3 = "vector", slot4 = "vector")) setMethod("print",
2003 Sep 09
1
No joy installing R with shared libs
>> Can some kind soul please give me a fool proof recipe for building R >> and RSPython so that it actually works? > I don't have a recipe, but one thought to help debug the process: Try > installing RPy [1]. RPy also provides access to R via Python and uses > the libR.so library. If you can install and "import rpy" without > problem then it must be
2002 Jul 19
1
Rprof and setMethod conflict?
I noticed this oddity about R profiling and setMethod. First, I "test out" Rprof. > require(methods) Loading required package: methods [1] TRUE > > Rprof("test.out") > data.frame("a") X.a. 1 a > Rprof(NULL) So far, so good. Next, I define myClass. > setClass("myClass", representation(mySlot = "numeric")) [1]
2003 May 07
3
how to order a dataframe ?
Hi, I've got a problem which seemed simple to me at first view, but which I haven't managed to solve yet. I have a dataframe, or a matrix, and I would like to order it along with one of the variables/columns. I tried to use order() but it remained quite unclear to me. How should I proceed ? Thanks in advance (I guess that's not very difficult a question for most of you) Laurent
2008 Apr 22
1
graphics::Axis loosing S3/S4 class attributes of 'x' in 2.7.0 RC
Following my previous post on S3 method despatch, I put debug messages in the code of Axis, Axis.default and plot.default in graphics/R/axis.R and graphics/R/plot.R to print the class of x, at and y on plot. After recompiling R, what I see is that x *lost* its class attribute (at least for classes not known to 'graphics') in Axis, called directly from plot.default and this could be the
2002 Aug 26
1
Rprof and setMethod conflict (PR#1949)
Full_Name: Kevin C. Bartz Version: 1.5.1 OS: Solaris 2.6 Submission from: (NULL) (192.223.226.5) A while ago, I noticed this oddity about R profiling and setMethod. First, I "test out" Rprof. > require(methods) Loading required package: methods [1] TRUE > > Rprof("test.out") > data.frame("a") X.a. 1 a > Rprof(NULL) So far, so good. Next, I
2010 Apr 30
1
S4 method execution time
Hello: I have written some an elementary S4 classes around a matrix to strengthen control of some key attributes. When I run a fairly elementary function ("f") on the matrix outside the class it runs instantaneously (elapsed system.time = 0) but when I setMethod "f" on myClass -- returning an instance of myClass -- it runs perceptibly slower (elapsed system.time = .06). I
2010 Jun 09
0
Documenting generic S4 replacement method for package building
Dear List Members, I'm struggling with the documentation of a generic S4 replacement method. I've created a S4 method "lows" via setGeneric("lows", function(object) standardGeneric("lows")) setGeneric("lows<-", function(object, value) standardGeneric("lows<-")) setMethod("lows", "myClass", function(object) {
2009 May 18
1
S4 method dispatch and namespaces: why is default method selected
Hi, I ran into the following peculiarity involving S4 method dispatch and namespaces. I develop a package which have a namespace and which depends on 'pixmap' package, which itself does not have a namespace. Now, in my package I have a class which has a slot for objects from class "pixmap" and I want to have a "plot" method for this new class. Not to clutter the
2003 Sep 26
1
installation : make fails (R-1.7.1 on RedHat 8.0)
Hi, I'm trying to compile R-1.7.1 from source (on a RedHat 8.0) instead of using the binary version, as it has often been advised. However I don't manage to find a solution to the following error which occurs during the make procedure : /!\-------------------------------------------/!\ building package 'ctest' mkdir -p -- ../../../library/ctest/R mkdir -p --
2003 Aug 19
2
R-1.7.1 gets installed without default packages & without readline
Hi all, Trying to install R-1.7.1 on a RedHat 8.0 platform, I have a few problems. R gets installed without default packages (but base and ctest) : make script fails at the end of the procedure (configure is made successfully). This is the (translated) log I have : /gcc -I../../../../include /usr/include/mysql -D__NO_MATH_INLINES -mieee-fp -fPIC -g -O2 -c ansari.c -o ansari.o gcc: cannot