similar to: How can I write methods for 'as()'?

Displaying 20 results from an estimated 3000 matches similar to: "How can I write methods for 'as()'?"

2011 Jun 29
1
Ref Classes: bug with using '.self' within initialize methods?
Dear list, I'm wondering if the following error I'm getting is a small bug in the Reference Class paradigm or if it makes perfect sense. When you write an explicit initialize method for a Ref Class, can you then make use of '.self' WITHIN this initialize method just as you would once an object of the class has actually been initialized? Because it seems to me that you can not.
2010 Nov 17
2
Reference classes: accessor functions via 'getRefClass(...)$accessors(...)'
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 from a database (or some other location), stores it to a buffer and
2010 Nov 23
1
Reference Classes: removing methods -> implications for objects/instances of that class
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 removed method until I do an explicit reassign ('my.instance <- getRefClass("Classname")$new()'), right?
2011 Mar 07
1
WG: Reference classes: error with missing arguments in method calls
Dear list, a while ago I posted this at r-devel but got no answers. Hope it?s okay to give it a shot again by cross-posting it here. TIA for any comments, Janko Von: Janko Thyson [mailto:janko.thyson.rstuff at googlemail.com] Gesendet: Montag, 21. Februar 2011 00:58 An: r-devel at r-project. org (r-devel at r-project.org) Betreff: Reference classes: error with missing arguments in method calls
2011 May 30
1
Query super- and subclasses of a class: is there a better way than to use 'completeClassDefinition()'
Dear List, when I first started to use S4 classes, I used the function 'completeClassDef()' in order to see the super- and subclasses of a certain class: setClass(Class="A", representation=list(a="numeric")) setClass(Class="B", contains="A", representation=list(b="character")) # Super x <- completeClassDefinition("B")
2011 Jun 03
2
Bug or feature: using "ANY" as a generic field class (was: '[R] Is there a (virtual) class that all R objects inherit from?)
Dear list, I was wondering if you could help me out in clarifying something: Is it possible to use class "ANY" in slots/fields of formal classes if you a) do not want to restrict valid classes of that field and b) if you are making explicit use of class inheritance? It seems to work in simple scenarios but produces errors when class inheritance comes into play. So I was
2011 May 19
1
Feature request: extend functionality of 'unlist()' by args 'delim=c("/", "_", etc.)' and 'keep.special=TRUE/FALSE'
Dear list, I hope this is the right place to post a feature request. If there's exists a more formal channel (e.g. as for bug reports), I'd appreciate a pointer. I work a lot with named nested lists with arbitrary degrees of "nestedness". In order to retrieve the names and/or values of "bottom layer/bottom tier", I love the functionality of 'unlist()', or
2011 May 27
1
Reference Classes/S4 Classes: can method dispatch check superclasses BEFORE resorting to method for "ANY"?
Dear list, is it possible that method dispatch checks for superclasses/virtual classes before checking "ANY"? I'd like to build a generic initialization method for all my Reference Class (say "MyDataFrame") objects by having them inherit from class, say "MyRefClassVirtual" (which would have to be a virtual S4 class; there are no virtual Reference Classes,
2011 Jun 06
1
Reference Classes: shortcut like 'isS4' for Ref Classes?
Dear list, is there a shortcut-function to check whether a class is a Reference Class or not? There's something like this for S4 classes ('isS4(object)'), but I couldn't find anything regarding Ref Classes. Currently, I'm doing it this way, which is a bit clumsy: A <- setRefClass("A", fields=list(X="numeric")) a <- A$new() isRefClass <-
2010 Nov 24
2
Reference Classes: how to clone/copy instances?
Dear list, I don't know what's the correct term for this in the OOP context, but is it possible to "clone"/copy an instance of a reference class (say 'a') so that I get an *autonomous* second instance 'b'? Autonomous in the sense that changes to 'a' do not affect 'b'. I know that this is somewhat against the pass-by-reference paradigm, but the
2010 Nov 21
1
reference classes: question on inheritance
Dear list, I have a reference class which should act as a "generic" superclass for other classes. I've read the respective section at ?setRefClass and put the name of the superclass to the 'contains' argument of an example subclass (see class defs below). Classnames are set in a way that shouldn't result in collation issues (virtual def sourced before superclass def
2010 Nov 21
1
Ref classes: can I register fields as I register methods?
Hi there, is it possible to register fields as you can register methods with getRefClass("Classname")$methods(.)? I know that you should usually give some thought on which fields you need and hardcode them in the class def. But I''m playing around with dynamically creating/extending sort of a template class that already offers basic functionality shared by all objects
2014 Nov 28
1
Feature request: mixing `...` (three dots) with other formal arguments in S4 methods
Well, the benefit lies in the ability to pass along arguments via `...` to more than one recipient that use *identical argument names* and/or when these recipients are not necessarily located on the same calling stack layer. I'm *not* after a *general* change in the way arguments are dispatched/functions are called as I'm actually a big friend of keepings things quite explicit (thus
2011 Oct 31
1
Question about copying reference objects using the initialize method
Dears, I have a question about copying reference objects using the initialize method. 1) If the latter has no arguments, there is no problem to copy an object. myClass = setRefClass("myClass", fields = list(value = "numeric") ) myClass$methods(initialize = function(...){ ? value <<- 1 ? callSuper(...) }) newObject = myClass$new() newObject$value = 2 copyObject =
2009 Aug 21
1
Function "nsl()" missing in package utils
Dear list, today I stumbled across the function ?nsl()? for the first time in order to perform a hostname lookup. According to the R Reference Index (Version 2.9.1, page 1522), the function should be part of the "utils" package. However, I cannot find it in the utils package of my installation(s). I've tried the R-versions 2.8.1, 2.9.0 and 2.9.1. I'd be very thankful if
2011 May 19
0
Flattening lists and environments (was: "how to flatten a list to the same level?")
Dear list, I came up with a two functions that flatten arbitrary deeply nested lists (as long as they're named; not tested for unnamed) and environments (see attachment; 'flatten_examples.txt' contains some examples). The paradigm is somewhat similar to that implemented in 'unlist()', yet extends it. I would have very much liked to build upon the superfast functionality
2014 Nov 27
2
Feature request: mixing `...` (three dots) with other formal arguments in S4 methods
Hi Gabriel, and thanks for answering. I'm basically just trying to find a way to use the power of `...` in more complex scenarios and I'm well aware that this might not be the best approach ;-) Regarding your actual question: "Are you suggesting methods be dispatched based on the *contents* of ... [...]?" Yes, I guess currently I kind of do - but not on the argument *names*
2014 Dec 15
1
Significant memory leak when using XML on Windows
Janko and I have been in touch. This is, I believe, a Windows specific issue and a compilation issue. I could be wrong, but that is my impression from other reports. When I have time (?! :-)), I will deal with it. Hopefully this will be very soon. Thanks Janko. D. On 12/14/14, 7:54 PM, Jeroen Ooms wrote: > On Thu, Dec 11, 2014 at 12:13 PM, Janko Thyson > <janko.thyson at gmail.com
2011 May 04
1
Reference Classes: replacing '.self' with an .Rda image of '.self' from within a method? (was replacing '.self' with an .Rda image of '.self' from within a method?)
Sorry guys, but I chose a really stupid name before (no "reference classes"). Hope it's okay to re-post. Cheers, Janko >>> ORIGINAL MESSAGE <<< Dear list, Is it possible to update or reassign '.self' with an image of '.self' (e.g. a locally stored .Rda file) from within a method? I know that this might sound akward, but here's the use
2011 Aug 30
1
Why does loading saved/cached objects add significantly to RAM consumption?
Dear list, I make use of cached objects extensively for time consuming computations and yesterday I happened to notice some very strange behavior in that respect: When I execute a given computation whose result I'd like to cache (tried both saving it as '.Rdata' and via package 'R.cache' which uses a own filetype '.Rcache'), my R session consumes about 200 MB of