similar to: How to change the value of a class slot

Displaying 20 results from an estimated 400 matches similar to: "How to change the value of a class slot"

2013 Apr 01
1
[LLVMdev] path profile result with LLVM
I want to get path profiling information with LLVM. LLVM provides methods for path profiling.I also get the llvmprof.out successfully. So I want to output the result.With llvm-prof ,I get the error:llvm-prof: Unkknown packet #5. So I have to write my own pass to output the path profiling result,the following is my kernel codes:
2012 Nov 13
1
Simulation with cpm package
Hi, I am running the following code based on the cpm vignette's code. I believe the code is syntactically correct but it just seems to hang R. I can get this to run if I set the sims to 100 but with 2000 it just hangs. Any ideas why? Thanks, Chris library(cpm) cpmTypes <- c("Kolmogorov-Smirnov","Mann-Whitney","Cramer-von-Mises") changeMagnitudes <- c(1, 2,
2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all, Assume that I have an S4 class "MyClass" with a slot "myname", which is initialized to: myname="" in method("initialize"): myclass <- new("MyClass", myname="") Assume that class "MyClass" has a method "mymethod": "mymethod.MyClass" <- function(object, myname=character(0), ...) {
2006 May 18
1
Recommended style with calculator and persistent data
I have some calculations that require persistent state. For example, they retain most of the data across calls with different parameters. They retain parameters across calls with different subsets of the cases (this is for distributed computation). They retain early analysis of the problem to speed later computations. I've created an S4 object, and the stylized code looks like this calc
2011 Dec 09
1
'callNextMethod' in a '[<-' function does not work ?
Hi the list, I try to use callNextMethod in a setteur ([<-) but it does not work. Any raison ? Any other option ? --- 8< ------------------ ### Class B0 ### setClass("B0" , representation(b0 = "numeric")) setReplaceMethod("[","B0",function(x,i,j,value){x at b0 <- -value}) a <- new("B0") a at b0 <- 3 a a["b0"] <- 3 a
2007 May 25
1
Question about setReplaceMethod
Hi I have the code like I show below. The problem here is that I have a setReplacementMethod to set the value of my class slot. However, this function doesn't work when I call it within another function definition (declared by setMethod) of the same class. I do not understand this behavior that much. I'm wondering how to make this work? Any help would be really appreciated. Thank you.
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi, I recognized that the function 'setReplaceMethod' is creating a character vector in the user workspace having the name (e.g. "newClass") of the class used as value. If you can sort out a mistake by myself, I would like you to file a bug report. BBFN, Jonathan setClass("newClass", representation(value="numeric")) setMethod(f = "initialize",
2017 Jun 23
1
setReplaceMethod creates 'object' in the userworkspace
Hi, I recognized that the function 'setReplaceMethod' is creating a character vector in the user workspace having the name (e.g. "newClass") of the class used as value. If you can sort out a mistake by myself, I would like you to file a bug report. BBFN, Jonathan setClass("newClass", representation(value="numeric")) setMethod(f = "initialize",
2006 Oct 31
1
setReplaceMethod
Hi If x <- 1:10 then x[5] <- 1i will promote x to be a complex vector. Suppose I have an S4 class "brob", and have functions is.brob(), as.brob(), as.numeric() and so forth (minimal self-contained code below). If x is numeric (1:10, say) and y is a brob, what is the best way to make x[5] <- y promote x to a brob in the same way as the complex example? Or is
2003 May 23
1
isSeekable returns F on seekable file
Hi, Seems that on RWin 1.7.0 and 1.6.2 isSeekable returns F on binary files, while seek() works as expected on the same connection - see example below: > con = file(nm, "rb") > isSeekable(con) [1] FALSE > readBin(con, double(), 10) [1] 7.263824e-317 5.968155e-317 2.340685e-317 2.734062e-312 4.088386e-312 4.670335e-317 [7] 6.097545e-317 3.396341e-312 6.615484e-317
2012 Sep 04
10
Generic asset definitions and management
(The following is not a Rails-specific question, but relates to a problem that affects Rails, so I wonder whether anyone on the team has an opinion about it or knows whether a solution is already in development.) While gem dependencies can be easily managed in a Gemfile by Bundler, when it comes to other assets, you either have to manually copy javascript files into the app/assets or vendor
2003 Jul 26
2
How to make "<-" generic?
Hi, perhaps a little bit unusual: is it possible to use "<- " as generic function with a new signature? The following example doesn't work: > isGeneric("<-") [1] FALSE > setClass("A",representation(x = "numeric")) [1] "A" > setClass("B",representation(x = "numeric")) [1] "B" > myAssign.A <-
2005 Mar 26
2
Is there a diferent way to do this?
Hi, I started creating a small class but I'm courious about how it is working. To create a instance of my class "Partri" I write this at Rgui: x <- new("Partri", name="Gilvan") and to change the slot "name" of this instance, I write: setName(x, newname="Justino") It is not working, because when I type "x" at Rgui, it shows
2007 Nov 13
5
How to overload the assignment operator?
Dear all, what is the proper way to make the assignment operator generic and define methods depending on the class of the assigned value? Best regards Jens Oehlschl?gel P.S. I vaguely remember that this was possible in S+. In R I tried to no avail: # using this like h<-1:3 gives Error: in `<-.default`(h, 1:3) : invalid (do_set) left-hand side to assignment
2011 Sep 14
1
S4 method dispatch
List, In order to get rid of some old, unreadable S3 code in package sp, I'm trying to rewrite things using S4 methods. Somewhere I fail, and I cannot sort out why. In order to isolate the problem, I created two functions, doNothing<- and dosth, and both should do nothing. The issue is that in most cases they do nothing, but in some cases dosth(obj) changes the class of obj and breaks with
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' )
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"))
2008 Apr 02
1
"[<-" plus drop-type extra argument
Hello I am writing a replacement method for an S4 class and want to pass an additional argument to "[<-"() along the lines of "["()'s "drop" argument. Specifically, I have an S4 class, call it "foo", with a slot 'x' that is a vector and a slot 'NC' that is a scalar. I want to be able to pass a Boolean argument to the
2007 Jul 05
17
ZFS Compression algorithms - Project Proposal
Bellow, follows a proposal for a new opensolaris project. Of course, this is open to change since I just wrote down some ideas I had months ago, while researching the topic as a graduate student in Computer Science, and since I''m not an opensolaris/ZFS expert at all. I would really appreciate any suggestion or comments. PROJECT PROPOSAL: ZFS Compression Algorithms. The main purpose of
2013 Oct 18
11
[GIT PULL] Btrfs
Hi Linus, My for-linus branch has a one line fix: git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus Sage hit a deadlock with ceph on btrfs, and Josef tracked it down to a regression in our initial rc1 pull. When doing nocow writes we were sometimes starting a transaction with locks held. Josef Bacik (1) commits (+1/-0): Btrfs: release path before starting