Hello Everyone! Here are a couple of thought/questions on refClasses
integration in R core functionality.
First, coexistence with S4:
> X <- setRefClass("classX", fields = c("a", "b"),
+ representation = list(c = "character"))
> x <- X$new()
> x...@c <- "sss"
> x
An object of c
an be
> referred to in a method by the reserved name .self|"|. That's a bit
> vague, and it's possible that one could update the slots of .self as
> part of slot assignment, but absent a serious example, it may be better
> to just clarify the documentation.
>
> O
This might be just beyond of my understanding of how assignment works in R, but
the documentation does not say anything about:
> tv <- c(a="dsf", b="sss")
> tl <- list(232)
> `$<-`(tl, tv[[1]], "sdfdsfdsfsd")
Error: invalid subscript type 'language'
This happens even before the method is dispatc
spinuvit.l...@gmail.com (Vitalie S.) writes:
> This might be just beyond of my understanding of how assignment works in R,
> but
> the documentation does not say anything about:
>
>> tv <- c(a="dsf", b="sss")
>> tl <- list(232)
>> `$<-`(
David Winsemius writes:
> On Oct 24, 2010, at 5:35 AM, Vitalie S. wrote:
>
>>
>> This might be just beyond of my understanding of how assignment works in R,
>> but
>> the documentation does not say anything about:
>>
>>> tv <- c(a="d
John Chambers writes:
> On 10/24/10 2:53 AM, Vitalie S. wrote:
>>
>> Thank you for the answer, John.
>>
>> John Chambers writes:
>>> Second point first: The actual environment of a function is tightly
>>> bound to low-level implementation at the C
> There are some things you are not really supposed to mess with in R...
> Computing the index to $-constructs is one of them (trying to set up a
> for loop as a call to `for` is another). It can be done, it's just
> rather painful, and most likely not what you wanted in the first place.
>
Sorry,
Simon Urbanek writes:
> On Oct 24, 2010, at 4:21 PM, Vitalie S. wrote:
>
>> David Winsemius writes:
>>
>>> On Oct 24, 2010, at 5:35 AM, Vitalie S. wrote:
>>>
>>>>
>>>> This might be just beyond of my understanding of how assignme
John Chambers writes:
>>
>> Not internals of the evaluator, the .environment class.
>> Something like:
>>- move the .self into a super-class of envRefClass (in this case
>> .environment),
>>- make the method for `...@` for .environment, such that any update of the
>>slots of the ob
spinuvit.l...@gmail.com (Vitalie S.) writes:
>
> I would expect the following to behave identically:
>
>> tv <- c(a="dsf", b="sss")
>> tl <- list(232)
>
>> `$<-`(tl, tv[[1]], "sdfdsfdsfsd")
> Error: invalid subscript ty
Hello everyone!
Would it be possible some day to use expressions as active bindings?
Something like
makeActiveExpression("foo", Expr0, env)
where Expr0 is executed in _env_ whenever "foo" is refereed.
The motivation for this question is fourfold:
- need to use <<- if the active binding is
John Chambers writes:
> Good diagnoses.
>
> This thread brought up a point or two that needed some fixes to the
> documentation and code. They should be in
> r-devel and 2.12 patched (from rev. 53471).
>
> Briefly:
>
> - Initialization methods should take account of future subclasses to your
>
Dear Developers,
A recently patched [[ for environment class returns a blank environment for a
children class:
setClass("myenv", contains = "environment")
#[1] "myenv"
env <- new("myenv")
class(env)
#[1] "myenv"
#attr(,"package")
#[1] ".GlobalEnv"
env[["a"]] <- 343
class(env)
[1] "environment"
Dear Developers,
callNextMethods does not work with "$"
setClass("mylist", contains = "list"):
setMethod("$",
signature(x = "mylist"),
function (x, name){
cat("here:\n")
callNextMethod()
})
tl <- new("mylist")
tl[["x"]] <- 343
tl$x
#her
eval(expr)
> + })
> [1] "$"
>> tl <- new("mylist")
>> tl[["z"]] <- 1
>> tl$z
> [1] 1
Thank you, that helps.
>
> On 11/10/10 4:49 AM, Vitalie S. wrote:
>> Dear Developers,
>>
>> callNextMethods does not work
Hello Everyone!
I am trying to extend the class "call", but keep getting errors whatever I do:
setClass("mycall", contains = "call")
#[1] "mycall"
new("mycall")
#Error in function (object) :
# error in evaluating the argument 'object' in selecting a method for function
#'show'
new("mycall",
"Janko Thyson" writes:
> Hi there,
>
> I'd like to choose between an "static" and "dynamic" access of a reference
> class field, say 'a'.
>
> myObj <- getRefClass("Blabla")$new()
>
> Static: myObj$a
>
> Dynamic: myObj$a.get() where the function retrieves the data
> f
"Janko Thyson" writes:
> Dear list,
>
> just to make sure that I understand 'unregistering' methods for S4 reference
> classes correctly:
>
> If I registered a method and want to 'unregister' (i.e. remove) this method
> again, objects/instance created of the respective class still feature the
> r
John Chambers writes:
> Well, it's an interesting idea, and the current implementation would fit with
> it.
>
> One catch is that it goes against any obvious notion of checking for valid
> objects (admittedly, there are some difficulties in that already with active
> bindings being used).
>
> Ano
Hello everyone!
Motivated by the recent post on SO
http://stackoverflow.com/questions/4730551/making-a-string-concatenation-operator-in-r
I wonder what is the current state of argument on making "+" to
concatenate character vectors. The "+" method is still sealed for
signature("character", "char
Gabor Grothendieck writes:
> On Sat, Jan 22, 2011 at 3:08 PM, Vitalie S. wrote:
>>
>> Hello everyone!
>>
>> Motivated by the recent post on SO
>>
> http://stackoverflow.com/questions/4730551/making-a-string-concatenation-operator-in-r>
>> I wonder wh
Spencer Graves writes:
> On 1/23/2011 8:50 AM, peter dalgaard wrote:
>> On Jan 22, 2011, at 21:08 , Vitalie S. wrote:
>>
>>> The only definite argument occurred in the thread against "+" operator
>>> was the lack of commutativity (as if one have to pro
Hi there,
I encounter the following problem with getGenerics
when Rgraphviz is installed:
which(!sapply(getGenerics(), isGeneric))
#graph Rgraphviz graph Rgraphviz
# 105 106 107 108
so, getGenerics returns twice graph and Rgrapviz as being generics, when they
are not:
i
Dear Developers,
In current implementation of validity method, objects are first coerced to
superclass (slots are striped). Thus, it is not possible to write validity
method which would perform some checks on children slots.
Say, I want to check if number of slots in a class is equal to "n"
On Tue, 18 Aug 2009 15:42:48 +0200, Martin Morgan
wrote:
"Vitalie S." writes:
Dear Developers,
In current implementation of validity method, objects are first
coerced to superclass (slots are striped). Thus, it is not possible
to write validity method which would perform some
On Tue, 18 Aug 2009 18:58:27 +0200, Martin Morgan
wrote:
Vitalie S. wrote:
On Tue, 18 Aug 2009 15:42:48 +0200, Martin Morgan
wrote:
"Vitalie S." writes:
Dear Developers,
In current implementation of validity method, objects are first
coerced to superclass (slots are stri
be
c("B", "A", "TEST").
Instead validity uses the vector of unique labels constructed *TOPDOWN* :
getAllSuperClasses(getClass("C"))
[1] "B" "TESTS" "A"
Apparently this is an inconsistency in implementation, isn't i
On Fri, 21 Aug 2009 11:21:03 +0200, Romain Francois
wrote:
Hi,
Would it be possible to add the capability for functions to register how
they would like to complete themselves.
Currently, there is the .addFunctionInfo, but it allows only functions
to register a static list of potential
Not sure, but another example may be a class dependent completion for
generic functions depending on first argument. Like print(df,... )
where df
a data.frame to complete, digits = NULL, quote = FALSE, right = TRUE,
row.names = TRUE instead of only (x,...).
That sort of already happens (ha
Dear All,
A small inconsistency (it's probably not even a buglet):
setClass("A", contains="numeric")
[1] "A"
names(new("A", c(a=23)))
[1] "a"
setClass("B", contains="A")
[1] "B"
names(new("B", c(a=23)))
NULL
This is exactly that kind of behavior S4 was invented for, you expect
n
On Fri, 16 Oct 2009 16:12:40 +0200, Ben Bolker wrote:
PS a parallel problem seems to occur in cut.Date ... cut.POSIXt and
cut.Date
both allow
breaks to be a single integer specifying the number of breaks, and both
call
if(is.null(labels)) levels(res) <- as.character(breaks[-length(bre
31 matches
Mail list logo