Displaying 20 results from an estimated 1000 matches similar to: "setMethodReplace.. Help!"
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
2003 Mar 02
1
'methods' and "[<-"
Dear List,
I am trying to override the replace method "[<-" for
objects of class "matrix"... with little success...
Would anyone know where I am wrong ?
> library(methods)
> setReplaceMethod("[", "matrix", function(x, i, j, ..., value) {cat("I'm here.\n")})
[1] "[<-"
> m <- new("matrix", 0, 5, 2)
>
2004 May 25
4
Object "silhouette.default" not found. But I knew that it is there.
Hi!
>library(cluster)
In this lib a function called silhoutte.default is defined
than on the R prompt it type
>silhouette.default
Error: Object "silhouette.default" not found
R1.9.0
The same error are at R1.8.1
And I knew that a function silhoutte.default are present.
But the same piece of code works in R1.6.2
???
Eryk
Dipl. bio-chem. Eryk Witold Wolski @
2003 Aug 21
2
efficiency and memory use of S4 data objects
I do lots of analyses on large microarray data sets so memory use and speed
and both important issues for me. I have been trying to estimate the
overheads associated with using formal S4 data objects instead of ordinary
lists for large data objects. In some simple experiments (using R 1.7.1 in
Windows 2000) with large but simple objects it seems that giving a data
object a formal class
2004 Jan 09
2
strange behaviour when converting from char to POSIX (PR#6422)
Full_Name: Christoph Schmutz, MeteoSchweiz, Switzerland
Version: R1.7.1, R1.8.1
OS: windows2000, solaris sunOS 5.8
Submission from: (NULL) (141.249.133.6)
I'm not sure if I don't get the clue, but please consider this:
> strptime("19930870150","%Y%j%H%M")
[1] "1993-03-28 01:50:00"
> strptime("19930870250","%Y%j%H%M")
[1]
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.
2004 May 11
2
- making a Windows library from Unix source code
Hi All,
I'm using R1.8.1 on Windows XP.
I'm having trouble producing an R library from source code. A colleague has written the source code, in Unix. I've copied the source code across to Windows (with the help files, data files, description and index) and am trying to compile it into a library.
I've "sourced" each of the *.r files and they appear to work.
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 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 <-
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'
)
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2003 Oct 13
2
Infinite recursion in getGeneric (PR#4561)
> setClass('foo')
[1] "foo"
> setMethod('is.logical', 'foo', function(x) TRUE)
[1] "is.logical"
> getGeneric('is.integer')
Error in options(x) : evaluation is nested too deeply: infinite
recursion?
>
--please do not edit the information below--
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system =
2004 Feb 09
2
data.frame to matrix
Hello all,
I've had trouble converting a data.frame to a matrix (numeric) using either
data.matrix() and as.matrix().
After executing one of those I end up with another data.frame with only the
first column of the original data.frame.
I use a window (tcltk) to let the user choose the columns he wants and then
I retrieve them using the following:
varstemp <-
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
2015 Jan 29
3
[Q] Get formal arguments of my implemented S4 method
On Jan 28, 2015, at 6:37 PM, Michael Lawrence <lawrence.michael at gene.com> wrote:
> At this point I would just due:
>
> formals(body(method)[[2L]])
>
> At some point we need to figure out what to do with this .local() confusion.
Agreed, definitely. The current hack is to avoid re-matching arguments on method dispatch, so a fix would need to be fairly deep in the
2004 Mar 30
2
Sweave and graphic output locations
Hello,
I'm using R1.8.1 on windows 2000 and version 1.8.1 of the tools package.
I am attempting to have Sweave write files to a different directory via:
testfile <- system.file("Sweave", "Sweave-test-1.Rnw",
package = "tools")
## create a LaTeX file
Sweave(
testfile,
output = "C:/temp/Sweave-test-1.tex",
2004 May 20
2
ifelse when test is shorter than yes/no
Hi,
It turns out that the 'test' vector in ifelse(test, yes, no) is not
recycled if it is shorter than the other arguments, e.g.
> ifelse(TRUE, seq(10), -seq(10))
[1] 1
Is there any particular reason it is not recycled? If there is one
indeed a warning message might be in order when someone calls ifelse
with a shorter 'test'.
This is R1.8.1 on RH-7.3
Thanks,
Vadim
2004 Aug 05
1
R interface to Python (in Windows)
I put a copy of R 1.8.1 for Windows on our FTP site at:
ftp://ftp.odot.state.or.us/outgoing/Test/. It should be there for a few
days before it gets deleted.
Benjamin Stabler
Transportation Planning Analysis Unit
Oregon Department of Transportation
555 13th Street NE, Suite 2
Salem, OR 97301 Ph: 503-986-4104
-----Original Message-----
From: Peter Wilkinson [mailto:pwilkinson at videotron.ca]