Re: [Rd] formatting of complex matrix

2016-03-19 Thread Duncan Murdoch
On 18/03/2016 6:09 AM, Lukas Stadler wrote: While working on the printing code, my colleague Zbyněk Šlajchrt noticed that complex matrixes are sometimes misaligned: { matrix(1i,2,13) } [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1

Re: [Rd] for in r-devel

2016-03-19 Thread Michael Lawrence
Thanks for pointing this out. The commit you cite was reverted a couple days later, because we are still thinking about how it should work. While it appears Date would benefit, weird things happen e.g. with POSIXlt and other data structures in the wild. This is due to inconsistency in the behaviors

Re: [Rd] match and unique

2016-03-19 Thread Hervé Pagès
Hi Terry, On 03/16/2016 08:03 AM, Therneau, Terry M., Ph.D. wrote: Is the phrase "index <- match(x, sort(unique(x)))" reliable, in the sense that it will never return NA? This is assuming that match() and unique() will never disagree on equality between 2 floating point values. I believe they

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Hervé Pagès
On 03/19/2016 06:35 AM, Michael Lawrence wrote: On Sat, Mar 19, 2016 at 4:29 AM, Hervé Pagès mailto:hpa...@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 mailto:hpa...@fredhutch.org>

[Rd] match and unique

2016-03-19 Thread Therneau, Terry M., Ph.D.
Is the phrase "index <- match(x, sort(unique(x)))" reliable, in the sense that it will never return NA? Context: Calculation of survival curves involves the concept of unique death times. I've had reported cases in the past where survfit failed, and it was due to the fact that two "differ by

[Rd] unary class union of an S3 class

2016-03-19 Thread Hervé Pagès
Hi, Short story --- setClassUnion("ArrayLike", "array") showClass("ArrayLike") # no slot setClass("MyArrayLikeConcreteSubclass", contains="ArrayLike", representation(stuff="ANY") ) showClass("MyArrayLikeConcreteSubclass") # 2 slots!! That doesn't seem right. L

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Michael Lawrence
On Sat, Mar 19, 2016 at 4:29 AM, Hervé Pagès wrote: > On 03/19/2016 01:22 AM, Michael Lawrence wrote: > >> >> >> On Sat, Mar 19, 2016 at 12:10 AM, Hervé Pagès > > wrote: >> >> On 03/18/2016 03:28 PM, Michael Lawrence wrote: >> >> >> On Fri, Mar 18, 2016 at

[Rd] formatting of complex matrix

2016-03-19 Thread Lukas Stadler
While working on the printing code, my colleague Zbyněk Šlajchrt noticed that complex matrixes are sometimes misaligned: > { matrix(1i,2,13) } [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i [2,] 0+1i

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Hervé Pagès
On 03/19/2016 01:22 AM, Michael Lawrence wrote: On Sat, Mar 19, 2016 at 12:10 AM, Hervé Pagès mailto:hpa...@fredhutch.org>> wrote: On 03/18/2016 03:28 PM, Michael Lawrence wrote: On Fri, Mar 18, 2016 at 2:53 PM, Hervé Pagès mailto:hpa...@fredhutch.org>

Re: [Rd] match and unique

2016-03-19 Thread Therneau, Terry M., Ph.D.
Herve, Thank you for the insightful response. It led to the following check: set.seed(1953) # a good year... x <- runif(5e6) ux <- sort(unique(x)) length(ux) [1] 4997142 table(is.na(match(x, ux)) FALSE 500 index1 <- match(x, ux) index2 <- findInterval(x, ux) all.equal(index1, ind

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Michael Lawrence
On Sat, Mar 19, 2016 at 12:10 AM, Hervé Pagès wrote: > On 03/18/2016 03:28 PM, Michael Lawrence wrote: > >> >> On Fri, Mar 18, 2016 at 2:53 PM, Hervé Pagès > > wrote: >> >> Hi, >> >> Short story >> --- >> >>setClassUnion("ArrayLike", "array

[Rd] keepNA in nchar and nzchar

2016-03-19 Thread William Dunlap via R-devel
Is it intended that in yesterday's version of R-devel the default value of keepNA is different in nchar (NA) and nzchar (FALSE)? > args(nchar) function (x, type = "chars", allowNA = FALSE, keepNA = NA) NULL > args(nzchar) function (x, keepNA = FALSE) NULL Is it intended that for keepN

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Hervé Pagès
On 03/18/2016 03:28 PM, Michael Lawrence wrote: On Fri, Mar 18, 2016 at 2:53 PM, Hervé Pagès mailto:hpa...@fredhutch.org>> wrote: Hi, Short story --- setClassUnion("ArrayLike", "array") showClass("ArrayLike") # no slot setClass("MyArrayLikeConcreteS