similar to: now S4 classes and packages

Displaying 20 results from an estimated 10000 matches similar to: "now S4 classes and packages"

2006 Apr 26
3
Test fixture syntax
OK, I know I''m doing something bone-headed, but I can''t for the life of me figure it out. I''ve read the test fixtures Rdoc about eight dozen times, and it says (to me) that if I have a YAML fixture file, dogs.yml that looks like this: fido: id: 1 breed: Terrier fifi: id: 2 breed: Poodle Then I can include fixtures :dogs in my functional test, and
2006 Jan 08
2
exporting methods/classes
Dear R People: I'm still struggling with sending methods and classes as part of creating a new package. Where does the .onLoad function go? Within R itself or in a file in one of the new package directories? Here are my latest efforts: Here's the last part of the woof1-Ex.Rout > library('woof1') Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
2002 May 11
0
rsync on Win32 doc
On the 'resources' area of the rsync website, I found a link to a quick howto on using rsync with cygnus. After a quick look over it, I found something that might be useful -- the doc says to create a special batchfile for rsync, to pass it the correct environment. In fact, I see no conflict between cygnus' environment and a standard windows environment. I didn't know where to
2007 Feb 28
12
Specifying that code is called in a block
Not sure if this is possible currently. I have a section of code like this: ActiveRecord::Base.transaction do cow.save! duck.save! dog.save! end (Names changed to protect the innocent.) I''d like to specify that the saves run in a transaction. I can do ActiveRecord::Base.should_receive(:transaction).and_yield But is there any way to specify that the code is
2013 Feb 05
1
S4 Classes and Initialize methods
Hello, I am trying to improve my skill on S4 classes. But there's something strange (to me) happening with "initialize" methods. This is probably a normal behaviour... but... something is unclear in my mind I declare two classes, namely "A", and "B", which has a slot of type A. The class "A" has an initialize method. What I do not understand is that
2012 Mar 15
1
Extending a group of S4 classes by setClassUnion ?
Hi, I would like to create some S4 classes as follows setClass("Father",representation(name="character")) setClass("Son1",contains="Father",representation(par="numeric")) setClass("Son2",contains="Father",representation(par="logical")) Son1<-new("Son1") Son1 at name<-"Son1" Son1 at par<-3
2004 Jun 02
3
S4 classes?
The following example, extracted from pp. 38-42 of Chambers (1998) Programming with Data (Springer), works for me in S-Plus 6.2 but not R 1.9.0pat, which returns the indicated error messages: > setClass('track', representation(x="numeric", y="numeric")) [1] "track" > tr1 <- new("track", x=1:3, y=4:6) > setMethod("plot", +
2010 Feb 09
1
Superimpose ksmooth() onto barplot
I'd like to superimpose a ksmooth() onto a barplot(). My data is: > d 2009-06-20 2009-06-21 2009-06-22 2009-06-23 2009-06-24 2009-06-25 2009-06-26 2009-06-27 2009-06-28 2009-06-29 2009-06-30 2009-07-01 2009-07-02 Same Breed (B) 12.64 21.08 13.52 12.51 13.71 9.91 14.24 7.18 11.81 5.92 12.04 17.96
2009 Oct 27
1
How to reduce key strokes when defining S4 classes?
I feel tedious when I define a S4 class and the methods. For each method, I have to call both setMethod and setGeneric (or both setReplaceMethod and setGeneric). I would like a more compact grammar so that I can reduce the key strokes. I'm wondering if there is a better way available. setClass( Class='A', representation=representation( x='numeric' )
2008 May 10
2
Hashes as S4 Classes, or: How to separate environments
For learning purposes mainly I attempted to implement hashes/maps/dictionaries (Python lingua) as S4 classes, see the coding below. I came across some rough S4 edges, but in the end it worked (for one dictionary). When testing ones sees that the dictionaries D1 and D2 share their environments D1 at hash and D2 at hash, though I thought a new and empty environment would be generated each time
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"))
2017 Apr 21
2
Relocation design of different architecture
Thanks for reply, it was really helpful. Can u just be more specific and tell about processRelocationRef() and resolveRelocation() in Targets/RuntimeDyld(objectfile format)(arch).h and also in RuntimeDyldELF.cpp and how the same function is implemented in different ways in both the files ? Thanks, Siddharth On Thu, Apr 20, 2017 at 8:16 PM, mats petersson <mats at planetcatfish.com> wrote:
2010 Apr 21
1
VERY basic question about S4 classes
Hi,   I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even though the two methods belong to the same class.     setClass(Class="SomeClass",      representation=representation(      
2010 Apr 18
1
Comparing data frames
Dear very helpful friends, It is Sunday, there is no air traffic in Europe, what better to do than try and learn me some more R. I have the following example: owner <- c(1:4) animal <- c("cat", "dog", "cat", "dog") char.1 <- c("fluffy", "playful", "mean", "stupid") food <- c("cat food",
2010 May 12
1
slot assignment in S4 classes
Hi R friends,   I'm still studying S4 classes and I have a question about slot assignment. Why would I have to use a special setter method [example 2 below] if I can assign data to a slot directly when I call new() [example 1 below]?   ## first way to do it (the idiosyncratic way?) setClass(Class = "TestClass", representation = representation(myDf = "data.frame"))
2011 Apr 05
1
super basic questions about S4 classes
Apologies for asking something that is probably super obvious, i just started with S4 classes and i guess i am not finding documentation that layout the grammar rules and give enough examples. Some questions i am having are these 1. I understand that main method of writing a member function is to write a generic function and setMethod for this particular object. This, however, presumes that there
2011 Nov 18
1
S4 : defining [<- using inheritance from 2 classes
Hi the list, I define a class 'C' that inherit from two classes 'A' and 'B'. 'A' and 'B' have no slot with similar names. ---------------- setClass( Class="C", contains=c("A","B") ) To define the get operator '[' for class "C", I simply use the get of "A" or "B" (the constante
2013 Mar 01
1
S4-classes: Assignment of values to slots by reference
Dear R-users, I am working on a project that uses S4-classes. At some point I encountered the problem - well known to R - that I have to pass 3 different objects to a function, that should modify several slots of them and of course there is no passing by reference in R. Then I read this thread by Steve Lianoglou: https://stat.ethz.ch/pipermail/r-help/2010-August/250468.html, which offers from
2010 May 29
3
S4 dispatch for .DollarNames (utils)
Hello, I'm trying to make .DollarNames generic and implement a method for it in a package. .DollarNames is the function that is now called to get completion possibilities. My R code looks like this: setGeneric( ".DollarNames" ) setClass("track", representation(x="numeric", y="numeric")) ## A class extending the previous, adding one more
2007 Dec 23
1
Problem with initialize of S4 classes
Dear all Below is the code for "scriptPreFilter.R" which gives the following result: > source("scriptPreFilter.R") > prefltr <- new("PreFilter", mad=c(0.5,0.01)) [1] "------initialize:PreFilter------" [1] "------initialize:Filter------" > str(prefltr) Formal class 'PreFilter' [package ".GlobalEnv"] with 2 slots