similar to: Extending data.frame

Displaying 20 results from an estimated 3000 matches similar to: "Extending data.frame"

2011 Oct 24
0
R.oo package: do setMethodS3 work upon construction
Hello (Heinrich), I did not know I could do this. It doesn't seem to be documented anywhere. Thought this would be helpful to the fraction of the community using package R.oo. Note the call of a setMethodS3 method, xOne, in the setConstructorS3. This is extremely useful if xOne (in this case) is a very complex method (that you always want to be called every time you create a new object). If I
2011 Oct 27
0
R.oo package, inherit two classes
Hello, How do I inherit two classes using the R.oo package. Below is kind of a silly example, but I am trying to create class PerDog from classes Dog and Person. Error at bottom. I've tried a few other ways of using extend(), but nothing seems to get me what I want. Example: setConstructorS3("Person", function(age=NA) { this = extend(Object(), "Person", .age=age )
2011 Aug 26
0
R.oo inheritance with pass by reference
I thought I would post an example of using R.oo with inheritance and pass by reference for future searches. With PerMore I am inheriting Person. Then I am changing an object data memeber of an object of PerMore class using pass by reference ('mimiced' by R.oo) in an object of AgeMultiplier. I change a data member in the child class and the parent class for demonstration purposes. This is
2008 Nov 05
1
Methods dispatch and inheritance R.oo
Hi to all members, i have a question about class inheritance and methods using R.oo package: I have the following code and it doesn't work, guess i'm doing smth wrong and there is nothing in the help. library(R.oo) setConstructorS3("ClassA", function(A=15) { extend(Object(), "ClassA", .size = A ); }) setMethodS3("print", "ClassA",
2011 Aug 26
1
R.oo data members / inheritance
If someone is able, can you tell me if there is a better way to do this? More specifically, do I have to rewrite all of the data members stuff and extend stuff of parent class in the child class? See below. Thanks in advance! Example 1: setConstructorS3("ClassA", function(A,x) { if(missing(A))A=15; if(missing(x))x=NA; extend(Object(), "ClassA", .size = A, .x=x
2003 Oct 27
1
Difficulties with R.oo (static fields, etc.)
I would like to use R.oo and tcltk to implement a Turtle World. I have encountered many problems because: 1) I am not sure how to implement static fields with R.oo 2) I am not sure how to implement a constructor that would call a function only for the first instance of a class (i.e., to initialize value of static fields only once) 3) I am not sure how to remove/delete cleanly existing
2011 Aug 18
0
Call super methods from inherited classes R.oo
Hi R-community, I'm very busy with a software project which I would like to development completely with R.oo. Many of the object oriented aspects that I already know from Java development seems to be in place with this library. But...there is something that I'm really missing... *the super method call* Just a little example that shall demonstrate what I mean: Image we have the following
2011 Jun 16
1
Question about R.oo package
Dear R.oo package users, while testing some functionality of the R.oo, I found that during the first construction of a object from a class, the constructor is twice called, but only one object is finalized. In all subsequent creation processes, the constructor is (expectedly) called once. Here some example code: library(R.oo) setConstructorS3("Test_class",function(val) {
2011 Sep 22
1
R.oo: do work on data member at construction
Hello, I'd like to 'do work' on data members upon construction (i.e. without implementing it in a get method). Is this the best way to create data member 'z' upon construction? I'm thinking if .z=paste(x,y) below gets more complex I'll run into issues. setConstructorS3("MyClass", function(x=NA,y=NA,...) { this <- extend(Object(), "MyClass",
2008 Apr 27
2
[LLVMdev] Two new 'llvmnotes'
On Apr 27, 2008, at 10:58 AM, Talin wrote: > I would certainly make use of this in my frontend. > > I suggest the names "getfield" and "setfield" for the two operations, > I agree that 'get/insertvalue' are pretty generic, and am welcome to suggestions. Get/set *field* imply that this applies only to structs, but it also works with arrays. I would
2008 Apr 27
0
[LLVMdev] Two new 'llvmnotes'
I would certainly make use of this in my frontend. I suggest the names "getfield" and "setfield" for the two operations, since (to me anyway) "insert" implies adding something new, as opposed to overwriting an existing value. Chris Lattner wrote: > Hi all, > > For anyone interested, I posted two new ideas for changes to the LLVM > IR. The first is
2008 Apr 27
0
[LLVMdev] Two new 'llvmnotes'
Chris Lattner wrote: > On Apr 27, 2008, at 10:58 AM, Talin wrote: > >> I would certainly make use of this in my frontend. >> >> I suggest the names "getfield" and "setfield" for the two operations, >> > > I agree that 'get/insertvalue' are pretty generic, and am welcome to > suggestions. Get/set *field* imply that this applies
2008 Apr 27
3
[LLVMdev] Two new 'llvmnotes'
On Apr 27, 2008, at 12:49 PM, Nick Lewycky wrote: > Chris Lattner wrote: >> On Apr 27, 2008, at 10:58 AM, Talin wrote: >> >>> I would certainly make use of this in my frontend. >>> >>> I suggest the names "getfield" and "setfield" for the two >>> operations, >>> >> >> I agree that
2008 Apr 27
0
[LLVMdev] Two new 'llvmnotes'
On 2008-04-27, at 15:56, Chris Lattner wrote: > On Apr 27, 2008, at 12:49 PM, Nick Lewycky wrote: > >> Chris Lattner wrote: >> >>> On Apr 27, 2008, at 10:58 AM, Talin wrote: >>> >>>> I would certainly make use of this in my frontend. >>>> >>>> I suggest the names "getfield" and "setfield" for the two
2011 Aug 23
1
R.oo modify an object inside another classes method
Can someone show me how to modify one (R.oo) class's object inside another (R.oo) class's method? Is that possible with the R.oo package? A quick example or reference to an example would be outstanding... Thanks, Ben [[alternative HTML version deleted]]
2005 Feb 16
0
Depends, require(), autoload() and "side effects"?
Hi. If your package require another package in order to define its methods (but afterwards in is not needed), how should one specify this? Is it correct to assume that "Depends" will assure that all packages are loaded (attached? what is the right word) *before* the methods in the current package are defined? Basically I use my own setMethod() called setMethodS3() that is defined in
2008 Mar 06
1
Argument "nomatch" matched by multiple actual arguments ... %in% -> match?!?
When I run R CMD check R.oo on R v2.7.0 devel (2008-03-04 r44677) on WinXP I get the following error while testing examples: Error in match(x, table, nomatch = 0) : formal argument "nomatch" matched by multiple actual arguments Calls: setMethodS3 -> setMethodS3.default -> %in% -> match Execution halted How is that even possible with: > get("%in%") function (x,
2009 Jul 17
1
Help with R.oo
Hi! I'm trying to learn about object oriented R, as it seems like it would be very useful. I'm going over an example from the documentation, and I'm very confused: http://www1.maths.lth.se/help/R/R.oo/ [assume you've called library (R.oo)] setConstructorS3("SavingsAccount", function(balance=0) { if (!is.numeric(balance) && length(balance) != 1)
2008 Oct 24
1
Help regarding oo package
Hi Henrik, I'm sorry to be bothering you, but there is something that I have been stuck with for a while now. I am trying to create a class like : setConstructorS3("MyPTCM",function(tokenslist=0) { extend(Object(), "MyPTCM", .gamma = 0.0, .rho = 0.0, .phi = 0.0, .tokenslist = tokenslist, .uniquetokens = unique(tokenslist),
2011 Aug 08
1
R.oo error upon construction
Hello, Using the R.oo package, how do I throw an error if a field is not present when the user of the class creates the object? Using the example in the R.oo package: setConstructorS3("Person", function(name, age) { if (missing(name)) name <- NA; if (missing(age)) age <- NA; extend(Object(), "Person", .name=name, .age=age ) }) [rest of class methods