similar to: Defining binary indexing operators

Displaying 20 results from an estimated 20000 matches similar to: "Defining binary indexing operators"

2005 Apr 20
5
Overloading methods in R
(1) It seems to me that, generally, in R it is not possible to overload functions. Is that right? (2) Assuming that the above is true, or partially true, is there any extra packages to handle overloading in R? (3) Assuming (1) is TRUE and (2) is FALSE, can anyone provide some advice on developing some function that understand what the arguments are and then calls the right overloaded
2007 Aug 17
3
Any parser generator / code assistance for R?
Hi, Is there any parser generator like www.antlr.org? Moreover, how does simple code assistance work currently in R? By 'simple code assistance' I meant things like: Object$M<TAB> --> Object$Method
2005 Jan 27
3
Indexing Lists and Partial Matching
I was unaware until recently that partial matching was used to index data frames and lists. This is now causing a great deal of problems in my code as I sometimes index a list without knowing what elements it contains, expecting a NULL if the column does not exist. However, if partial matching is used, sometimes R will return an object I do not want. My question, is there an easy way of getting
2006 Oct 16
1
The old question: R vs MATLAB vs Mathematica vs ...
Hi, This question seems to be old, however I am asking it from a different point of view. R introduces itself as a 'statistical' language and environment. There are many discussions about comparing R to MATLAB or mathematica (or other similar software). It seems to me that these other software have a broader range of applications. For example, in Mathematica one can solve a partial
2005 Apr 21
1
Limitations of generic functions
(1) Assume we have some automatic C++ wrapper which , briefly, reads the C++ files and generates some R files in which the equivalent of the C++ classes are reconstructed. (2) As the OO design of R is different to that of C++, some isses exist when creating an interface between these two systems. (I said these two are 'different', I didn't say which one is better or which one is
2005 Apr 24
1
Collade doesn't work for more than 256 files!
Last week I managed to automatically wrap over 600 C++ classes into R in less than 24 hours. It was not because I am an expert in R programming, it was simply because I wrapped the classes as S3. Not only the wrapping process was easy, but also installation process and loading the final library was fast too. Now I am also trying to do the wrapping into the 'modern' S4 classes. This
2005 Jun 15
2
need help on computing double summation
Dear helpers in this forum, This is a clarified version of my previous questions in this forum. I really need your generous help on this issue. > Suppose I have the following data set: > > id x y > 023 1 2 > 023 2 5 > 023 4 6 > 023 5 7 > 412 2 5 > 412 3 4 > 412 4 6 > 412 7 9 > 220 5 7 > 220 4 8 > 220 9 8 > ...... > Now I want to compute the
2019 Jul 07
3
Possible bug in `class<-` when a class-specific '[[.' method is defined
Hi all ! I noticed a strange behaviour of the function `class<-` when a class-specific '[[.' method is defined. Here below a reproducible example : #-------------------------------------------------------------------. counttt <- 0 `[[.MYCLASS` = function(x, ...) { counttt <<- counttt + 1 # browser() x = NextMethod() return(x) } df <- as.data.frame(matrix(1:20,
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
2007 May 28
7
$$ is slooooow in IE
While $$ and getElementsByClassName are ridiculously speedy in Firefox (thanks to XPath), I''m finding both functions to be intolerably slow in IE. The page I''m working with has fewer than 1000 elements -- doesn''t seem THAT big -- and it''s still taking upwards of 4 seconds (!) to pick out the right ones. Are there documented problems with particular
2009 Dec 18
1
How to define new operators
Dear R community I try to create a new operator to build a special sum of two CashFlows. (my S4 Class) I tried the following but this is actually not what I want. setGeneric("++",function(e1,e2)standardGeneric("++")) setMethod("+",signature=list("CashFlow","CashFlow"),function(e1,e2){ print("+") })
2002 Aug 05
1
pipe and binary i/o
I often want to use "pipe" with "readBin" to read (binary) data from the standard output of a Perl or C program. For that I need "pipe" to work with the "open='rb'" option. It never worked for me, and after a look at the connections.c file, I see that in "pipe_open" the mode gets passed directly to "popen" (I'm using Linux on
2012 Jun 20
4
binary operators that never return missing values
Hi, I work with data sets with lots of missing values. We often need to conduct logical tests on numeric vectors containing missing values. I've searched around for material and conversations on this topic, but I'm having a hard time finding anything. Has anyone written a package that deals with this sort of thing? All I want are a group of functions like the ones I've posted
2002 Dec 12
1
improving ts object
Dear all, Currently, a ts object behaves like an array, and it would be very useful to have a similar object, which would behave like a data.frame, i.e. it could be indexed, named, etc. like a data.frame. What would be the most efficient way to construct such an object? I have tried to make one on my own following the directions of class design from "S Programming" (2000) as a
2019 Jul 15
4
Possible bug in `class<-` when a class-specific '[[.' method is defined
Hello, Clean R 3.6.1 session on Ubuntu 19.04, RStudio 1.1.453. sessionInfo() at the end. I can reproduce this. counttt <- 0 `[[.MYCLASS` = function(x, ...) { counttt <<- counttt + 1 # browser() x = NextMethod() return(x) } df <- as.data.frame(matrix(1:20, nrow=5)) class(df) <- c("MYCLASS","data.frame") counttt #[1] 9 But there's more. I
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" >
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"),
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",
2007 Jul 24
3
How to require a defined type...
Hi all, I''m struggling with the following: I have a defined type wrapped in a class: class myclass { define mytype(bla) { file { "blabla": .... } exec { "blablabla": ... } } } And I access the defined type in my other class by doing this: class otherclass { include myclass myclass::mytype { "alb": ... } # and here I want to
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), ...) {