similar to: Discrepancy between is.list() and is(x, "list")

Displaying 20 results from an estimated 30000 matches similar to: "Discrepancy between is.list() and is(x, "list")"

2019 Mar 26
4
Discrepancy between is.list() and is(x, "list")
If I can merge this thread with the one I started yesterday... > "If the object does not have a class attribute, it has an implicit class..." > which I take to mean that if an object does have a class attribute it does not also have an implicit class. > I think this is reasonable behavior. Consider the "Date" class, which stores values as "numeric": >
2019 Mar 27
2
Discrepancy between is.list() and is(x, "list")
> you had seemed to be presenting it as something new in 3.5.3. I would be surprised if the behavior doesn't go all the way back to whenever head.function was added. My bad. I'm just surprised I've never noticed these problems before. > S3 classes have no formal definitions at all > I'm not sure what is clear about that, or what class hierarchy you're talking about
2019 Mar 26
0
Discrepancy between is.list() and is(x, "list")
In the case of inherits (at least) this seems intended. The help page says: "If the object does not have a class attribute, it has an implicit class..." which I take to mean that if an object does have a class attribute it does not also have an implicit class. The behavior you noted below will apply to other types bearing implicit classes. For example: > inherits(1.0,
2019 Mar 26
0
Discrepancy between is.list() and is(x, "list")
I think this goes back to SV4 (c. late 1990's). The is.<type> functions are much older (c. mid 1970's) , from before any class system was in S. is() and inherits() were introduced with the S4 class system and were meant to escape from the prison made by ancient design choices. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Mar 26, 2019 at 2:11 PM Abs Spurdle <spurdle.a
2019 Mar 26
0
Discrepancy between is.list() and is(x, "list")
Hi Abs, Lets try to remain civil even when disagreeing about major design philosophies, ok? On Tue, Mar 26, 2019 at 2:08 PM Abs Spurdle <spurdle.a at gmail.com> wrote: > If I can merge this thread with the one I started yesterday... > > > "If the object does not have a class attribute, it has an implicit > class..." > > which I take to mean that if an object
2019 Mar 27
2
Discrepancy between is.list() and is(x, "list")
> the prison made by ancient design choices That prison of ancient design choices isn't so bad. I have no further comments on object oriented semantics. However, I'm planning to follow the following design pattern. If I set the class of an object, I will append the new class to the existing class. #good class (object) = c ("something", class (object) ) #bad class (object)
2003 Oct 02
1
"[[<-","[[" default?
Hi! I have implemented class specific behaviour of "[[<-.myclass"<-function(). How it is posible to call the "[[.default" on an object of myclass? Eryk Dipl. bio-chem. Eryk Witold Wolski @ MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: wolski@molgen.mpg.de ---W-W----
2019 Mar 29
1
Discrepancy between is.list() and is(x, "list")
I know I said that I had no further comments on object oriented semantics. However, I found a contradiction in the R documentation. Gabriel Becker wrote: > So, there are implicit classes, but *only when the data object is NOT an "R object" In the R Language Definition: > The R specific function typeof returns the type of an R object. > Lists have elements, each of which can
2019 Nov 15
2
class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]
> > And indeed I think you are right on spot and this would mean > > that indeed the implicit class > > "matrix" should rather become c("matrix", "array"). > > I've made up my mind (and not been contradicted by my fellow R > corers) to try go there for R 4.0.0 next April. I'm not enthusiastic about matrices extending arrays. If a
2010 Jun 13
1
S4 classes and S3 generic functions
A general goal for the next version of R is to make S4 and S3 play better together. As mentioned in a previous thread, one limitation has been that S3 generic functions, specifically the UseMethod() call, did not make use of S4 inheritance when dispatching on general S4 objects. This has been fixed in a version committed today (updated to rev 52267). The code change is not large, but it
2003 Aug 16
4
unclass
Have I been sleeping in class? rw1071 from CRAN, windows XP incidencia is made by a call to tapply > class(incidencia) [1] "array" > incidencia <- unclass(incidencia) > class(incidencia) [1] "array" Kjetil Halvorsen
2019 Mar 27
0
Discrepancy between is.list() and is(x, "list")
Abs et al, Ok, so I have just gone and re-read the docs again. My language was a more absolute than it should have been; *however*, I was still correct for the cases under discussion. From ?UseMethod (emphasis mine) An R object is a data object which has a ?class? attribute (and this can be tested by ?is.object?). A class attribute is a character vector giving the names of the
2004 Feb 24
1
Inheriting from factors + co.
I'm trying to create a formal class that does the following: 1) accept objects of arbitrary class as .Data slot 2) provide a set of other slots that are of fixed type (as usual) The following two approaches came to my mind: A) setClass("myclass", representation("ANY", x = "numeric", y ="numeric")) new("myclass", 1:10) # works
2014 Nov 17
1
common base functions stripping S3 class
Hi all --- this is less a specific question and more general regarding S3 classes. I've noticed that quite a few very common default implementations of generic functions (e.g. `unique`, `[`, `as.data.frame`) strip away class information. In some cases, it appears conditionals have been created to re-assign the class, but only for a few special types. For example, in `unique.default`, if the
2019 Mar 26
3
bugs in head() and tail()
(Using R 3.5.3). I found bugs in head() and tail(). The following works: > f = function () 1 > head (f) 1 function () 2 1 However, the following does not: > class (f) = "f" > head (f) Error in x[seq_len(n)] : object of type 'closure' is not subsettable [[alternative HTML version deleted]]
2023 May 19
1
range() for Date and POSIXct could respect `finite = TRUE`
Hi All, I think there may be some possible confusion about what allowsInf would be reporting (or maybe its just me :) ) if we did this. Consider a class "myclass", S3, for starters, with setMethod("allowsInf", "myclass", function(obj) FALSE) Then, what would myclassthing <- structure(1.5, class = "mything") myclassthing[1] <- Inf do. Assumely it
2019 Oct 31
2
head.matrix can return 1000s of columns -- limit to n or add new argument?
Hmm, the problem I see here is that these implied classes are all inherently one-off. We also have > inherits(matrix(1,1,1),"numeric") [1] FALSE > is.numeric(matrix(1,1,1)) [1] TRUE > inherits(1L,"numeric") [1] FALSE > is.numeric(1L) [1] TRUE and if we start fixing one, we might need to fix all. For method dispatch, we do have inheritance, e.g. >
2005 May 11
7
bug in modulus operator %% (PR#7852)
The following can't be right, first rw2010: > 1 %% 0.001 [1] 0.001 Then rw2001: > 1 %% 0.001 [1] -2.081668e-17 > and the last seems about right. -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus.
2006 Aug 03
2
get() in sapply() in with()
Dear All, applying some function within a with() function I wanted to use also sapply() and get() to form a data.frame, but did not succede. Below is a simplified example. It is possible to use sapply() within a with() function, it is also possible to use get() within a with() function, but when I try to use get within sapply within with I arrive at "Error in get(x, envir, mode, inherits) :
2020 Apr 04
5
Help useRs to use R's own Time/Date objects more efficiently
This is mostly a RFC [but *not* about the many extra packages, please..]: Noticing to my chagrin how my students work in a project, googling for R code and cut'n'pasting stuff together, accumulating this and that package on the way all just for simple daily time series (though with partly missing parts), using chron, zoo, lubridate, ... all for things that are very easy in base R *IF*