similar to: Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

Displaying 20 results from an estimated 6000 matches similar to: "Defining a `show` function breaks the print-ing of S4 object -- bug or expected?"

2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
On 30/06/2015 1:57 PM, Hadley Wickham wrote: > A slightly simpler formulation of the problem is: > > show <- function(...) stop("My show!") > methods::setClass("Person", slots = list(name = "character")) > methods::new("Person", name = "Tom") > #> Error in (function (...) : My show! Just to be clear: the complaint is
2015 Jun 30
0
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
A slightly simpler formulation of the problem is: show <- function(...) stop("My show!") methods::setClass("Person", slots = list(name = "character")) methods::new("Person", name = "Tom") #> Error in (function (...) : My show! Hadley On Tue, Jun 30, 2015 at 9:02 AM, Dean Attali <daattali at gmail.com> wrote: > Hi r-devel >
2019 Feb 20
2
Bug in print.default: dispatches to global show instead of methods::show
This is related to a problem that was fixed in 2015 https://github.com/wch/r-source/commit/38ea40dcd0353af16d35296ee621338c49ae48c9 The problem then was that auto-printing by typing an object to the console would search for show() in the globalenv instead of in the methods namespace. The problem I would like to report is that it seems that when an S4 object is printed with print(), a similar
2015 Jul 12
2
Why no support for 3-digit HEX colours?
When specifying an RGB colour in R, is there a strong reason not to accept 3-character HEX codes? In CSS and many other languages, a colour of "#ABC" is automatically converted to "#AABBCC", and I was wondering if R could support that as well, or if it was a conscious decision to not support it. --- http://deanattali.com [[alternative HTML version deleted]]
2015 Aug 03
2
'vapply' not returning list element names when returned element is a length-1 list
Hi all Sorry for the confusing title. I noticed the following inconsistency: If i have a function that returns a named list with 2 (or more) elements, then using 'vapply' retains the names of the elements: > vapply(1:3, function(x) list("foo" = "bar", "hello" = "world"), > vector("list", 2)) [,1] [,2] [,3] foo
2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
Same thing happens with S3 if you redefine print(). I thought that code was actually calculating the function to call rather than the symbol to use, but apparently not. Shouldn't be too hard to fix. luke On Tue, 30 Jun 2015, Hadley Wickham wrote: > On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch > <murdoch.duncan at gmail.com> wrote: >> On 30/06/2015 1:57 PM, Hadley
2015 Jul 08
5
Graphical User Interface (GUI)
I'd like to create a user interface for my R code and have only seen mostly older posts on the subject. I'm not looking for an IDE for development, but something that the end user of the software would use. So something that would involve displaying buttons, listboxes, and drop down menus to a user that will facilitate various actions. I doubt there is anything Visual Studio-like that
2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
On 30/06/2015 5:27 PM, Lorenz, David wrote: > There is something I'm really missing here. The function show is a > standardGeneric function, so the correct way to write it as method like > this: That describes methods::show. The problem is that the default print mechanism isn't calling methods::show() (or base::print() as Luke says), it's calling show() or print() in the
2020 Apr 14
4
Suggestion/opinions: add a `absolute` param to `normalizePath()` to force returning an absolute path
This request stems off a bug report I posted https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17757 where it was determined the current behaviour is as expected. To recap: when given a real file, normalizePath() always* returns the full absolute path. When given a non-existent file, normalizePath() returns a full path on Windows but it returns the input on other systems*. I'd argue that
2015 Jun 30
1
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
On 30/06/2015 7:04 PM, Paul Gilbert wrote: > > > On 06/30/2015 11:33 AM, Duncan Murdoch wrote: >> On 30/06/2015 5:27 PM, Lorenz, David wrote: >>> There is something I'm really missing here. The function show is a >>> standardGeneric function, so the correct way to write it as method like >>> this: >> >> That describes methods::show. The
2015 Jun 30
0
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
There is something I'm really missing here. The function show is a standardGeneric function, so the correct way to write it as method like this: setMethod("show", "Person", function(object) { for an object of class "Person" for example. Dave On Tue, Jun 30, 2015 at 10:11 AM, <luke-tierney at uiowa.edu> wrote: > Same thing happens with S3 if you
2015 Jun 30
0
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
On 06/30/2015 11:33 AM, Duncan Murdoch wrote: > On 30/06/2015 5:27 PM, Lorenz, David wrote: >> There is something I'm really missing here. The function show is a >> standardGeneric function, so the correct way to write it as method like >> this: > > That describes methods::show. The problem is that the default print > mechanism isn't calling methods::show()
2018 Jun 29
1
Bug in tools::md5sum - does not work when filepath contains tilde (ie home directory)
I've reproduced on ubuntu and winodws with R3.4.3 When the filepath contains a tilde, the result is NA. But if the file path is expanded then the function works. Example: tools::md5sum("~/.Rprofile") returns NA tools::md5sum(normalizePath("~/.Rprofile")) returns the proper md5 Perhaps this is expected behaviour because the documentation does say NA is returned for
2010 Jul 21
1
fix()ing an S4 method
Hi R experts,   The fix() function canbe used to edit normal functions. I would like to know whether it's also possible to use something similar to edit a method of an S4 class. In other words, is there a fix-like function that allows me to edit method definitions without having to go back to the source code?   setGeneric (name="doStuff",def =
2005 Aug 18
2
Use of contains in S4 classes
setClass("B", representation=representation("B", extra="numeric)) setClass("B", representation=representation(extra="numeric"), contains="B") Are these the same? If not, how do they differ? What about setClass("B", representation=representation("B", extra="numeric"), contains="B") ? As far as I can
2010 Feb 02
1
S4 setClass / initialize misunderstanding
Hi, I recently ran into this problem. I couldn't find any mention of it in the setClass documentation. setClass("Foo", representation(file = "character")) setMethod("initialize", "Foo", function(.Object, file) { print(file) }) setClass("Bar", contains = "Foo") And the error: Error in print(file) : argument "file" is
2012 Oct 18
1
S4 fails to initialize linear hierarchies with intermediate VIRTUAL classes
Initialization of this simple hierarchy A = setClass("A", representation(x="numeric")) setClass("B", contains=c("VIRTUAL", "A")) C = setClass("C", contains="B") fails (neat that setClass returns generators; I hadn't realized that before!) > C(A()) Error: evaluation nested too deeply: infinite recursion /
2007 May 21
1
list element names in S4 class extending list
can list names attributes be preserved through S4 class containment? seems to be so but only if the containment relationship is direct ... see below. > setClass("c1", contains="list") [1] "c1" > l1 = list(a=1, b=2) > o1 = new("c1", l1) > names(o1) # pleasant surprise [1] "a" "b" > setClass("c2",
2017 Jun 06
2
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
Hi, It's nice to be able to define S4 classes with slots that correspond to standard attributes: setClass("A1", slots=c(names="character")) setClass("A2", slots=c(dim="integer")) setClass("A3", slots=c(dimnames="list")) By doing this, one gets a few methods for free: a1 <- new("A1", names=letters[1:3])
2011 Jan 28
2
help with S4 objects: trying to use a "link-glm" as a class in an object definition
Hi, I'm trying to make a new S4 object with a slot for a "link-glm" object. R doesn't like me have a slot of class "link-glm" > class(make.link("probit")) [1] "link-glm" > setClass("a",representation(item="link-glm")) [1] "a" Warning message: undefined slot classes in definition of "a": item(class