similar to: questions on generic functions

Displaying 20 results from an estimated 50000 matches similar to: "questions on generic functions"

2006 Oct 17
1
Caching bug with showMethods?
showMethods isn't reporting inherited methods when it is first called. The methods are there and after calling them, showMethods gives the right output. Here is an example (using R-devel r39647): setClass("A", representation(x="numeric"), prototype=list(x=1)) setClass("B", contains="A", prototype=list(x=2))
2008 Mar 30
1
package.skeleton.S4
Hi the devel list. I am adapting the package.skeleton to S4 classes and methods I would have been very proud to post a new working function on this list. Unfortunately, I do not manage to solve all the problems. Mainly - sys.source does not compile a file with setClass - dumpMethod does not exists yet In the following code, thise two problems are notified by a line ################# Still
2013 Feb 14
4
2 setGeneric's, same name, different method signatures
hi. below is a small test case (hopefully minimal, though i'm still a bit confused about initializers). i would have guessed (and maybe i still would have been right) that one could re-use the name of a generic function for functions with different numbers of arguments. in the case below, class A's bB() queries the status of a single A object, so bB(A) (where here "A" is an
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
2010 Mar 01
1
Method dispatch
Dear all, In a package, I defined a method for "summary" using setMethod(summary, signature="abc") for my class "abc", but when the package is loaded, the function "summary(x)" where x is of class "abc" seems to have called the default summary function for "ANY" class. Shouldn't it call the method I have defined? How could I get
2012 Nov 15
1
bug with mapply() on an S4 object
Hi, Starting with ordinary vectors, so we know what to expect: > mapply(function(x, y) {x * y}, 101:106, rep(1:3, 2)) [1] 101 204 309 104 210 318 > mapply(function(x, y) {x * y}, 101:106, 1:3) [1] 101 204 309 104 210 318 Now with an S4 object: setClass("A", representation(aa="integer")) a <- new("A", aa=101:106) > length(a)
2010 Feb 26
2
New methods for generic functions show and print : some visible with ls(), some not
Dear all, I'm trying to understand the S4 way of object-oriented programming, but I still can't grasp completely what R is doing. I have a class definition for a class called PM10Meteo, and I set a initializer function. next, I include a show method and a print method as shown below. setClass( Class="PM10Meteo",...) # end setClass setMethod
2008 Dec 22
2
... (dotMethods) and cbind/rbind: how to give the signature?
Dear List, I'm struggling with the signature writing cbind/rbind functions for a S4 class. First of all, I'm very happy that it is now possible to dispatch on ... I follow the example for "paste" in ?dotMethods, which works as far as this: ### start example setClass ("cbtest", representation = representation (data = "data.frame"),
2012 Jun 28
1
undefined S4 class in parallel computing at snowfall
Dear All, I have a question of how to export S4 class specification to clusters/workers in parallel computing. The package I used is snowfall. The problem is reproducible as follows. Any hint is greatly appreciated. Edwin Sun === begin =========== library(snowfall) sfInit(parallel = TRUE, cpus = 2) setClass("catt", representation(aa = "numeric")) setClass("dogg",
2011 Sep 13
1
error trying to create replicated volume on EC2
I'm not sure I'm doing this right. I have two identical machines, A and B.: ----------------------- CONSOLE ----------------------- A ~$: gluster peer probe domU-BB-BB-BB-BB.compute-1.internal Probe successful A ~$: gluster peer status Number of Peers: 1 Hostname: domU-BB-BB-BB-BB.compute-1.internal Uuid: 8d5d9af4-6a92-4d56-b063-c8fc9ac17a45 State: Peer in Cluster (Connected) B ~$:
2004 Mar 03
1
match.call(), S4
I get different results from match.call(), according to whether a function is dispatched via S3 or S4. Specifically, when I use S4 dispatch in the following example, the match.call() result is of length 1 less than I expect. I need to add an extra comma to get the same results as in the S3 method. --------example setClass("foo",representation("matrix"))
2011 May 23
1
Applying boxplot.stats to multiple value lists
Hello all R gurus, I have a following problem which I hope someone will help me to solve. I have a data.frame in form similar to below. > testframe<-data.frame("Name"=c("aa","aa","aa","aa","aa","bb","bb","bb","bb","bb"),"Value"=c(1,100,1,1,1,100,100,100,100,1))
2006 May 22
2
confused by inheritance...
Hi r-devels, I am stuck in some S4 inheritance problem: setClass("A",representation(a="numeric")) setClass("A1",representation(b="numeric"),contains="A") setClass("A2",representation(c="numeric"),contains="A1") if(!isGeneric("foo")){ setGeneric("foo", function(x,y,z, ...)
2010 May 18
2
Counting Frequencies in Data Frame
Hi, I am sure there is an easy way to do it, but I can't find it. I have a data frame that has 15 columns and 7000 rows. The only values inside the data.frame are "aa", "ab", "bb" as you can see an example bellow. 1 2 3 1 aa ab ab 2 ab ab ab 3 aa aa aa 4 bb bb bb What I would like to do, is to generate a vector (or another data.frame) with 7000 rows, and 3
2008 Mar 10
1
crossprod is slower than t(AA)%*BB
Dear Rdevelopers The background for this email is that I was helping a PhD student to improve the speed of her R code. I suggested to replace calls like t(AA)%*% BB by crossprod(AA,BB) since I expected this to be faster. The surprising result to me was that this change actually made her code slower. > ## Examples : > > AA <- matrix(rnorm(3000*1000),3000,1000) > BB <-
2001 Dec 18
4
chi-squared test
I don't quite understand the difference between the two methods for performing a chi-squared test on contingency tables: summary(table()) and chisq.test() They may different results. E.g.: aa <- gl(2, 10) bb <- as.factor(c(1,2,2,2,1,2,1,2,2,2,1,2,2,2,1,1,1,2,1,1)) aa <- c(aa, aa) bb <- c(bb, bb) table(aa, bb) summary(table(aa, bb)) chisq.test(aa, bb) Could somebody give me
2010 Apr 14
1
Sig differences in Loglinear Models for Three-Way Tables
Hi all, I've been running loglinear models for three-way tables: one of the variables having three levels, and the other two having two levels each. An example looks like below: > yes.no <- c("Yes","No") > switch <- c("On","Off") > att <- c("BB","AA","CC") > L <- gl(2,1,12,yes.no) > T <-
2008 Dec 09
1
package "wmtsa": wavCWTPeaks error (PR#13381)
Full_Name: Maura Monville Version: 2.8 OS: Mac OS/X 10.5 Submission from: (NULL) (87.4.122.234) Here is the code that causes wavCWTPeaks error aats <- create.signalSeries(aa, pos=list(from=0.0, by=0.033)) aa.cwt <- wavCWT(aats) x11 (width=10,height=12) plot (aats,main=paste(insig," Cycle: ",j,sep="")) aa.maxtree <- wavCWTTree (aa.cwt,
2008 Sep 26
1
Xen and DHCP problem
Hey folks! I want to add a CentOS 5.2 domU to an existing server (Fedora 8) which was setup by another company. The Dom0 does not provide any other services but a BIND-DHCP-server (they deleted dnsmasq and installed bind). Don''t ask my why they did that. My new DomU is connected to eth0, which is a bridge. BIND also listens on eth0 to serve other machines. I start the install of centos
2010 Aug 30
2
Band-wise Conditional Sum - Actual problem
Dear R helpers, Thanks a lot for your earlier guidance esp. Mr Davind Winsemius Sir. However, there seems to be mis-communication from my end corresponding to my requirement. As I had mentioned in my earlier mail, I am dealing with a very large database of borrowers and I had given a part of it in my earlier mail as given below. For a given rating say "A", I needed to have the bad-wise