Displaying 20 results from an estimated 10000 matches similar to: "as.list method for by Objects"
2018 Feb 01
0
as.list method for by Objects
>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>> on Tue, 30 Jan 2018 15:57:42 -0800 writes:
> I just meant that the minimal contract for as.list() appears to be that it
> returns a VECSXP. To the user, we might say that is.list() will always
> return TRUE.
Indeed. I also agree with Herv'e that the user level
2018 Jan 30
0
as.list method for by Objects
On 01/30/2018 02:50 PM, Michael Lawrence wrote:
> by() does not always return a list. In Gabe's example, it returns an
> integer, thus it is coerced to a list. as.list() means that it should be
> a VECSXP, not necessarily with "list" in the class attribute.
The documentation is not particularly clear about what as.list()
means for list derivatives. IMO clarifications
2018 Jan 30
2
as.list method for by Objects
I just meant that the minimal contract for as.list() appears to be that it
returns a VECSXP. To the user, we might say that is.list() will always
return TRUE. I'm not sure we can expect consistency across methods beyond
that, nor is it feasible at this point to match the semantics of the
methods package. It deals in "class space" while as.list() deals in
"typeof() space".
2018 Feb 01
2
as.list method for by Objects
On Thu, Feb 1, 2018 at 12:14 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>>> on Tue, 30 Jan 2018 15:57:42 -0800 writes:
>
> > I just meant that the minimal contract for as.list() appears to be that it
> > returns a VECSXP. To the user, we might say
2018 Jan 30
2
as.list method for by Objects
by() does not always return a list. In Gabe's example, it returns an
integer, thus it is coerced to a list. as.list() means that it should be a
VECSXP, not necessarily with "list" in the class attribute.
Michael
On Tue, Jan 30, 2018 at 2:41 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> Hi Gabe,
>
> Interestingly the behavior of as.list() on by objects seem to
2018 Jan 30
0
as.list method for by Objects
Hi Gabe,
Interestingly the behavior of as.list() on by objects seem to
depend on the object itself:
> b1 <- by(1:2, 1:2, identity)
> class(as.list(b1))
[1] "list"
> b2 <- by(warpbreaks[, 1:2], warpbreaks[,"tension"], summary)
> class(as.list(b2))
[1] "by"
This is with R 3.4.3 and R devel (2017-12-11 r73889).
H.
On 01/30/2018 02:33 PM,
2018 Jan 30
2
as.list method for by Objects
Dario,
What version of R are you using. In my mildly old 3.4.0 installation and in
the version of Revel I have lying around (also mildly old...) I don't see
the behavior I think you are describing
> b = by(1:2, 1:2, identity)
> class(as.list(b))
[1] "list"
> sessionInfo()
R Under development (unstable) (2017-12-19 r73926)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
2018 Jan 30
0
as.list method for by Objects
I agree that it makes sense to expect as.list() to perform
a "strict coercion" i.e. to return an object of class "list",
*even* on a list derivative. That's what as( , "list") does
by default:
# on a data.frame object
as(data.frame(), "list") # object of class "list"
# (but strangely it drops the names)
2018 May 16
0
Dispatch mechanism seems to alter object before calling method on it
On Wed, May 16, 2018 at 12:23 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> On 05/16/2018 10:22 AM, Michael Lawrence wrote:
>>
>> Factors and data.frames are not structures, because they must have a
>> class attribute. Just call them "objects". They are higher level than
>> structures, which in practice just shape data without adding a lot of
2018 May 16
1
Dispatch mechanism seems to alter object before calling method on it
On 05/16/2018 01:24 PM, Michael Lawrence wrote:
> On Wed, May 16, 2018 at 12:23 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>> On 05/16/2018 10:22 AM, Michael Lawrence wrote:
>>>
>>> Factors and data.frames are not structures, because they must have a
>>> class attribute. Just call them "objects". They are higher level than
>>>
2017 May 03
0
stopifnot() does not stop at first non-TRUE argument
On 05/03/2017 12:04 PM, Herv? Pag?s wrote:
> Not sure why the performance penalty of nonstandard evaluation would
> be more of a concern here than for something like switch().
which is actually a primitive. So it seems that there is at least
another way to go than 'dots <- match.call(expand.dots=FALSE)$...'
Thanks,
H.
>
> If that can't/won't be fixed, what about
2017 May 15
0
stopifnot() does not stop at first non-TRUE argument
Hello,
I am a new on this list, so I introduce myself very briefly:
my background is applied mathematics, more precisely scientific calculus
applied for modeling metabolic systems, I am author/maintainer of
few packages (Deriv, rmumps, arrApply).
Now, on the subject of this discussion, I must say that I don't really understand
Peter's argument:
>>> To do it differently,
2017 May 03
2
stopifnot() does not stop at first non-TRUE argument
Not sure why the performance penalty of nonstandard evaluation would
be more of a concern here than for something like switch().
If that can't/won't be fixed, what about fixing the man page so it's
in sync with the current behavior?
Thanks,
H.
On 05/03/2017 02:26 AM, peter dalgaard wrote:
> The first line of stopifnot is
>
> n <- length(ll <- list(...))
>
>
2017 May 15
0
stopifnot() does not stop at first non-TRUE argument
>>>>> Serguei Sokol <sokol at insa-toulouse.fr>
>>>>> on Mon, 15 May 2017 13:14:34 +0200 writes:
> I see in the archives that the attachment cannot pass.
> So, here is the code:
[....... MM: I needed to reformat etc to match closely to
the current source code which is in
2018 May 16
0
Dispatch mechanism seems to alter object before calling method on it
Factors and data.frames are not structures, because they must have a
class attribute. Just call them "objects". They are higher level than
structures, which in practice just shape data without adding a lot of
semantics. Compare getClass("matrix") and getClass("factor").
I agree that inheritance through explicit coercion is confusing. As
far as I know, there are only
2017 May 15
2
stopifnot() does not stop at first non-TRUE argument
>>>>> Herv? Pag?s <hpages at fredhutch.org>
>>>>> on Wed, 3 May 2017 12:08:26 -0700 writes:
> On 05/03/2017 12:04 PM, Herv? Pag?s wrote:
>> Not sure why the performance penalty of nonstandard evaluation would
>> be more of a concern here than for something like switch().
> which is actually a primitive. So it seems that
2020 May 24
0
paste(character(0), collapse="", recycle0=FALSE) should be ""
Herve (et al.),
On Fri, May 22, 2020 at 3:16 PM Herv? Pag?s <hpages at fredhutch.org> wrote:
> Gabe,
>
> It's the current behavior of paste() that is a major source of bugs:
>
> ## Add "rs" prefix to SNP ids and collapse them in a
> ## comma-separated string.
> collapse_snp_ids <- function(snp_ids)
> paste("rs", snp_ids,
2018 Feb 01
0
sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31
>>>>> Herv? Pag?s <hpages at fredhutch.org>
>>>>> on Tue, 30 Jan 2018 13:30:18 -0800 writes:
> Hi Martin, Henrik,
> Thanks for the follow up.
> @Martin: I vote for 2) without *any* hesitation :-)
> (and uniformity could be restored at some point in the
> future by having prod(), rowSums(), colSums(), and others
>
2016 Mar 19
0
unary class union of an S3 class
On Sat, Mar 19, 2016 at 4:29 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> On 03/19/2016 01:22 AM, Michael Lawrence wrote:
>
>>
>>
>> On Sat, Mar 19, 2016 at 12:10 AM, Herv? Pag?s <hpages at fredhutch.org
>> <mailto:hpages at fredhutch.org>> wrote:
>>
>> On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>>
>>
>>
2017 Nov 29
0
binary form of is() contradicts its unary form
Hi Herve,
Interesting observation with `setClass` but it is for S4. It looks
like `data.frame()` is not an S4 class.
> isS4(data.frame())
[1] FALSE
And in your case this might help:
> is(asS4(data.frame()), "list")
[1] TRUE
Looks like `is` is designed for S4 classes, I am not entirely sure.
Best,
-Mehmet
On 29 November 2017 at 20:46, Herv? Pag?s <hpages at