similar to: substitute and S4 objects

Displaying 20 results from an estimated 30000 matches similar to: "substitute and S4 objects"

2006 Apr 12
1
yet another problem with S4 dispatch (with setClassUnion)
Dear John and Seth, dear R-devels, once again the question of method dispatch in S4 -- this time with setClassUnion(); taking up your advice in https://stat.ethz.ch/pipermail/r-devel/2006-April/037200.html https://stat.ethz.ch/pipermail/r-devel/2006-April/037201.html I have been too quick in stating that >setClassUnion()---at least in my case---solves the problem; > The problem arises
2006 Apr 07
4
setIs and method dispatch in S4 classes
Dear all, I have a question regarding setIs and method dispatch in S4 classes: Consider the following example: ##################################################### ## A02 "contains" A01 by setIs: setClass("A01", representation(a="numeric",b="numeric")) setClass("A02", representation(a="numeric",d="numeric"))
2006 Sep 15
1
setMethod() woes
Hello everybody R version 2.4.0 alpha (2006-09-15 r39323), MacOSX 10.4.7 Next S4 problem. I have "brob" objects that are large real numbers, and now I want "glub" numbers that are to be a pair of glubs that represent complex numbers. I want to define binary operator "+" so that if either the left or right argument are glubs, it uses .ArithGlub. If either
2009 Nov 25
1
group generics
I have classes A and B, where B contains A. In the implementation of the group generic for B I would like to use the corresponding group generic for A. Is there a way to do that? I would also appreciate any comments if what I'm trying to do seems like the wrong approach. Here's a stripped down example: setClass("A",
2004 Jul 06
1
questions about setMethod("Arith", ...)
Hi, we have some questions concerning the definition of new arithmetic methods. In our package "distr" (on CRAN) we define some new arithmetic methods for "+", "-", "*", "/". After loading "distr" the corresponding arithmetic methods work. Now, if we define a new class and also a new method for one of the arithmetic methods
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
2006 Sep 01
1
setMethod("Logic", ...)
Hi In V&R the "polynomial" class is explicitly specified to have no logical operators: setMethod("Logic", signature(e1="polynomial"), function(e1,e2){stop ("...")}) I too have a class of objects for which I want to specify that Logic operators do not work, but executing setClass("brob", representation = representation
2017 Sep 01
2
Precision error in time index of ts objects
I have a time series x, and two other series obtained from it: x <- structure(2017, .Tsp = c(2017.41666666667, 2017.41666666667, 12), class = "ts") y <- floor(x) z <- x-y I would expect the three series to have exactly the same index. However I get the following > time(x)-time(y) Jun 2017 0 as expected, but > time(x)-time(z) integer(0) Warning message: In
2011 Feb 05
1
Seeking help to define method for '+'
Dear all, I am trying to define "+" method for my newly defined s4 class which is as follows: setClass("Me", sealed=F,representation(x1 = "numeric", x2 = "character")) new1 <- new("Me", x1=2, x2="comment1") new2 <- new("Me", x1=3, x2="comment1") setMethod("+", "Me",
2003 Jun 10
1
c(...) and methods
I have been writing some S4 classes and have a problem about how I might pass a signature to "c()". Take the following example: setClass("collection", representation("list", date="POSIXt")) x <- new("collection", list(1,2,3), date=Sys.time()) y <- new("collection", list(4,5,6), date=Sys.time()) obviously, I can do c(x,y), but
2017 Sep 01
0
Precision error in time index of ts objects
You already know the answer. Why ask? -- Sent from my phone. Please excuse my brevity. On September 1, 2017 7:23:24 AM PDT, Andrea Altomani <altomani.andrea at gmail.com> wrote: >I have a time series x, and two other series obtained from it: > >x <- structure(2017, .Tsp = c(2017.41666666667, 2017.41666666667, 12), >class = "ts") >y <- floor(x) >z <-
2005 Jun 29
1
Failed "make check" under Fedora Core 4 (PR#7979)
I downloaded R v2.1.1 earlier this morning to compile under Fedora Core 4. It compiled without incident, but 'make check' failed. Below is the relevant part of its report. Is this a known problem? I used a locally compiled version of GCC v4.0.0 that reports [kent at d89h102 R-2.1.1]$ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.0.0/configure
2013 Apr 24
1
multiple issues with is.unsorted()
Hi, In the man page for is.unsorted(): Value: A length-one logical value. All objects of length 0 or 1 are sorted: the result will be ?NA? for objects of length 2 or more except for atomic vectors and objects with a class (where the ?>=? or ?>? method is used to compare ?x[i]? with ?x[i-1]? for ?i? in ?2:length(x)?). This contains many incorrect
2008 Aug 07
1
'"ts" treated as a registered S3 class, but keep its "structure" behaviour' ?
Dear all, In R-devel I have noticed the new approach for the "ts" class in the package "methods". the "structure" behaviour of "ts" is not always kept when one uses "ts" objects and objects of classes which extend the virtual class "structure". As a short example: ## this works fine setClass("foo", representation(header =
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("+") })
2008 Jan 22
1
deparse, substitute and S4 generics
Hello everyone, I encountered the following confusing behavior of 'deparse' and 'substitute' while programming with S4 classes (see example below). It seems like the presence of '...' argument in the definition of the generic generates the problem. I have no clue why, can anyone explain that to me? Are there any "workarounds"? Thanks a lot for your time!
2009 Jul 29
3
Object equality for S4 objects
To test two environments for object equality (Lisp EQ), I can use 'identity': > e1 <- environment(local(function()x)) > e2 <- environment(local(function()x)) > identical(e1,e2) # compares object identity [1] FALSE > identical(as.list(e1),as.list(e2)) # compares values as name->value mapping [1] TRUE # (is there a
2017 Sep 01
2
Precision error in time index of ts objects
I should have formulated my question in a more specific way. 1. I suspect this is a floating point precision issue. I am not very knowledgeable about R internals, can someone else confirm it? 2. Should this be considered a bug or not, because it is "just a precision issue"? Should I report it? 3. How can it happen? From a quick review of ts.R, it looks like the values of the time
2017 Sep 01
0
Precision error in time index of ts objects
On Fri, 1 Sep 2017, Andrea Altomani wrote: > I should have formulated my question in a more specific way. > > 1. I suspect this is a floating point precision issue. I am not very > knowledgeable about R internals, can someone else confirm it? Yes. If you represent a series with increment 1/12 it depends on how you do it. As a simple example consider the following two descriptions
2006 May 02
4
"a"+"b"
Hi, Is there a way to define "+" so that "a"+"b" returns "ab" ? > setMethod("+",c("character","character"),paste) Error in setMethod("+", c("character", "character"), paste) : the method for function '+' and signature e1="character", e2="character" is sealed