similar to: Operator overloading

Displaying 20 results from an estimated 10000 matches similar to: "Operator overloading"

2011 Jun 01
1
Overloading S4 methods
Dear all, I am experiencing some problems with S4 method overloading. I have defined a generic for graphics:plot, using setGeneric("plot", useAsDefault = plot) and with importFrom('graphics', 'plot') and exportMethods('plot') in the NAMESPACE file of pkg A. I then proceed to define a method for signature c('myS4class', 'missing'). This works
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!
2010 Mar 23
1
Operator overloading for custom classes
Hi, I need some help to get some of the object orientation, specifically the methods that overload the basic arithmetic operations, from sample C++ code to R. I don't have experience with such advanced language features inside of R. So I was wondering if some of you could help me out in this regard. I have written a simple demonstration of a forward mode automatic differentiator in C++ and
2010 Mar 23
1
: Operator overloading for custom classes
Hi, I need some help to get some of the object orientation, specifically the methods that overload the basic arithmetic operations, from sample C++ code to R. I don't have experience with such advanced language features inside of R. So I was wondering if some of you could help me out in this regard. I have written a simple demonstration of a forward mode automatic differentiator in C++ and
2011 Nov 02
1
overloading + operator for chars
Hello,   I would like to overload the "+" operator so that it can be used to concatenate two strings, e.g "John" + "Doe" = "JohnDoe". How can I 'unseal' the "+" method? > setMethod("+", signature(e1="character", e2="character"), function(e1, e2) paste(e1, e2, sep="") ) Error in
2007 Aug 18
2
Problem with lsa package (data.frame) on Windows XP
Dear R team, The following piece of code (to use the lsa package) works fine on my mac os x, but when I run the same code on Windows XP, it doesn't work any more. ### code: library("lsa") matrix1 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 000\\LSA\\cuentos\\", stemming=TRUE, language="spanish", minWordLength=2, minDocFreq=1,
2007 Mar 09
4
Using large datasets: can I overload the subscript operator?
Hello, I do some computations on datasets that come from climate models. These data are huge arrays, significantly larger than typically available RAM, so they have to be accessed row-by-row, or rather slice-by slice, depending on the task. I would like to make an R package to easily access such datasets within R. The C++ backend is ready and being used under Windows/.Net/Visual Basic, but I have
2009 May 09
1
"Overloading" some non-dispatched S3 methods for new classes
Hello, I am building a package that creates a new kind of object not unlike a dataframe. However, it is not an extension of a dataframe, as the data themselves reside elsewhere. It only contains "metadata". I would like to be able to retrieve data from my objects such as the number of rows, the number of columns, the colnames, etc. I --quite naively-- thought that ncol, nrow,
2012 May 03
1
* operator overloading & setOldClass
Dear R gurus, I am trying to overload some operators in order to let these work with the ff package by registering the S3 objects from the ff package and overloading the operators as shown below in a reproducible example where the "*" operator is overloaded. require(ff) setOldClass(Classes=c("ff_vector")) setMethod( f="*", signature = signature(e1 =
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" >
2008 Jun 18
3
Number of digits in paste funciton
Hi! Does anyone know hot to set number of digits to be printed in function 'paste'? Tine Mla?
2006 Feb 13
1
Problem with overloading add type casts of numeric strings in PHP bindings
Overloaded methods are mapped in PHP to their implementation (_SWIG_0, _SWIG_1, ..) based on the types and number of arguments the user supplies. However, if one overload accept a string and another an integer the bindings fail to separate them since PHP treats numeric strings much the same as integers. The problem is illustrated in WritableDatabase_replace_document() which takes either the
2008 May 21
2
'Extracting' plot area
Hi! Does anyone know hot to save (to png, pdf, ...) only plot area. That is without box around, titles, axis, ... I tried: par(mar=c(0,0,0,0)) and it works for internal viewer (linux and windows). But when I save the image in png it adds that annoying margin around plot area. Any ideas? by, Tine
2010 Mar 03
0
[LLVMdev] folding x * 0 = 0
On 03/03/2010 10:36 PM, David Greene wrote: > On Wednesday 03 March 2010 13:13:50 Chris Lattner wrote: >>> Why not at first create a compile time option for this so that the >>> code is already available for special purposes? >> I'm not sure how that would work, but it most likely wouldn't fit with the >> design of llvm. If this is important, I'd
2006 May 08
3
operator overload on views
In my User auth scheme I have a userlevel. I''ve overloaded the User class operators like this: def >(item) if item.class == "User" self.userlevel > item.userlevel else self.userlevel > item end end (other operators are overloaded in essentially the same way). As I understand it, using the operator ">" inside the overloaded
2016 Jul 26
2
Help wanted: Overloading an Intinsic
Hello All, I have been modifying LLVM a project of mine, and have encountered issues with overloading an intrinsic function. I have defined two types, abit (which is mapped, in Intrinsics.td, to i128) and qbit (accordingly mapped to i16). I would like my intrinsic function, CNOT(x,y), to accept either an abit or a qbit for each argument, so I overload with iAny and llvm_anyint_ty, as seemed to
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
2006 Oct 27
1
Overloading functions
Hi Everyone I have a function f which does something using a function g. Function f is in a library and g has a default stub in the library but will be mainly overloaded in a later R script. For example: ########## In a compiled package 'P' ################# g <- function() { cat("Original function g"); } f <- function( newGsource=NULL ) { if(
2011 Jul 12
1
[LLVMdev] Overloading intrinsic with pointer to pointer
Hi, I've noticed that if I try to overload an intrinsic with a pointer to pointer my call to Intrinsic::getDeclaration, for example with an i8** type. Ultimately, this is because Intrinsic::getName (lib/VMCore/Function.cpp#338) only removes one level of indirection from the passed pointer type, so calls getEVTString on a pointer type resulting an in Invalid EVT assertion
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