[Rd] Support for as(x, "raw")

2024-05-14 Thread Hervé Pagès
"ANY", "list"))     Method Definition:     function (from, to, strict = TRUE)     {         value <- as.list(from)         if (strict)             attributes(value) <- NULL         value     }         Signatures:         from  to     target  "ANY" "lis

Re: [Rd] Question regarding .make_numeric_version with non-character input

2024-04-25 Thread Hervé Pagès
On 4/25/24 07:04, Kurt Hornik wrote: ... > Sure, I'll look into adding something. (Too late for 4.4.0, of course.) > > Best > -k Great. Thanks! H. -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTM

Re: [Rd] Question regarding .make_numeric_version with non-character input

2024-04-25 Thread Hervé Pagès
On 4/24/24 23:07, Kurt Hornik wrote: >>>>>> Hervé Pagès writes: >> Hi Kurt, >> Is it intended that numeric_version() returns an error by default on >> non-character input in R 4.4.0? > Dear Herve, yes, that's the intention. > >> It

Re: [Rd] Question regarding .make_numeric_version with non-character input

2024-04-24 Thread Hervé Pagès
peof(x)) >>> if(tolower(Sys.getenv("_R_CHECK_STOP_ON_INVALID_NUMERIC_VERSION_INPUTS_")) >>> != "false") >>> stop(msg, domain = NA) >>> else >>> warning(msg, domain = NA, immediate. = TRUE) >>> >>> If you use bugzilla before and have a handle, maybe file a bug report with >>> this as patch athttps://bugs.r-project.org/ >>> >>> Dirk >>> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Spurious warning in as.data.frame.factor()

2024-03-18 Thread Hervé Pagès
S4 generic?) Is > >> there any hidden state I may be breaking for the rest of the test this > >> way? > >> The test does pass like this, so this may be worrying about nothing. > > > Indeed, this coul

[Rd] Spurious warning in as.data.frame.factor()

2024-03-12 Thread Hervé Pagès
] stats graphics  grDevices utils datasets  methods base other attached packages: [1] BiocGenerics_0.49.1 loaded via a namespace (and not attached): [1] compiler_4.4.0 -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]]

Re: [Rd] NOTE: multiple local function definitions for ?fun? with different formal arguments

2024-02-06 Thread Hervé Pagès
that you have a > function object in your function which can't be called > unconditionally.  The workaround doesn't create such an object. > > Recognizing that your function never tries to call fun requires global > inspection of toto(), and most of the checks are based on local > inspection. > > Duncan Murdoch > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] NOTE: multiple local function definitions for ‘fun’ with different formal arguments

2024-02-03 Thread Hervé Pagès
): toto <- function(mode) {     if (mode == 1)     fun <- function(a, b) a*b     else     fun <- function(u, v, w) (u + v) / w     fun } Is that NOTE really intended? Hard to see why this code would be considered "wrong". I know it's just a NOTE but still...

Re: [Rd] Should subsetting named vector return named vector including named unmatched elements?

2024-01-18 Thread Hervé Pagès
e is a better > solution, the `menu[select]` seems to allocate more memory than > `menu_env = list2env(menu); mget(select, envir = menu, ifnotfound = > list(NULL)`. Or the sapply solution. Is this a benchmarking artifact? > > https://stackoverflow.com/q/77828678/4868692 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] 'R CMD INSTALL' keeps going on despite serious errors, and returns exit code 0

2023-11-04 Thread Hervé Pagès
I see. We'll update soon. Thanks Martin. On 11/4/23 06:52, Martin Maechler wrote: >>>>>> Hervé Pagès >>>>>> on Fri, 3 Nov 2023 15:10:40 -0700 writes: > > Hi list, > > > Here is an example: > > >     hpages@XPS15

Re: [Rd] 'R CMD INSTALL' keeps going on despite serious errors, and returns exit code 0

2023-11-03 Thread Hervé Pagès
gnature ‘object="CoreSet"’:  arguments (‘verbose’) after ‘...’ in the generic must appear in the method, in the same place at the end of the argument list     Error: package or namespace load failed for ‘CoreGx’:      unable to load R code in package ‘CoreGx’ Best, H. On 11/3/23 15:10, Herv

[Rd] 'R CMD INSTALL' keeps going on despite serious errors, and returns exit code 0

2023-11-03 Thread Hervé Pagès
  prettyunits_1.2.0 tools_4.4.0 crayon_1.5.2  [9] desc_1.4.2    callr_3.7.3   pkgbuild_1.4.2 ps_1.7.5 -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)

2023-10-30 Thread Hervé Pagès
on of R-devel!} > modified the behavior of `dim<-` somewhat > such it does *not* unnecessarily drop dimnames, > e.g., in your `dim(x) <- dim(x)` case above, > one could really argue that it's a "true loss" if x loses > dimnames "unnecessarily" ... > >

Re: [Rd] as(, "dgTMatrix")' is deprecated.

2023-10-04 Thread Hervé Pagès
uot;CsparseMatrix" or > "TsparseMatrix" or "dMatrix", "symmetricMatrix". > > In the case of as(, "dgTMatrix") , if you > replace "dgTMatrix" by "TsparseMatrix" > the result will be the same but also work in the future when the &

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-25 Thread Hervé Pagès
On 9/25/23 07:05, Martin Maechler wrote: >>>>>> Hervé Pagès >>>>>> on Sat, 23 Sep 2023 16:52:21 -0700 writes: > > Hi Martin, > > On 9/23/23 06:43, Martin Maechler wrote: > >>>>>>> Hervé Pagès > &g

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-23 Thread Hervé Pagès
Hi Martin, On 9/23/23 06:43, Martin Maechler wrote: >>>>>> Hervé Pagès >>>>>> on Fri, 22 Sep 2023 16:55:05 -0700 writes: > > The problem is that you have things that are > > **semantically** different but look exactly the sa

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
On 9/22/23 16:55, Hervé Pagès wrote: > The problem is that you have things that are **semantically** > different but look exactly the same: > > They look the same: > > > x > [1] NA > > y > [1] NA > > z > [1] NA > > > is.na(x) > [1] TRUE >

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
should never be > expecting identical() to treat different types as the same (e.g. > identical(NA, NA_real_) is FALSE, as it should be).  If you are using > a different test, that's user error. > > Duncan Murdoch > > On 22/09/2023 2:41 p.m., Hervé Pagès wrote: >&

Re: [Rd] Recent changes to as.complex(NA_real_)

2023-09-22 Thread Hervé Pagès
e NA in the sense of is.na(.), but their > Re() and Im() are not all NA: > >showC <- function(z) noquote(sprintf("(R = %g, I = %g)", Re(z), Im(z))) >z <- complex(, c(11, NA, NA), c(NA, 99, NA)) >z >showC(z) > > gives > >> z >[1] NA NA NA >> showC(z) &

Re: [Rd] FYI: daily R source tarballs from ETH: *.xz instead of *.bz2)

2023-09-12 Thread Hervé Pagès
On 9/11/23 22:39, Prof Brian Ripley wrote: > On 09/09/2023 01:56, Hervé Pagès wrote: >> Hi Martin, >> >> Sounds good. Are there any plans to support the xz compression for >> package source tarballs? > > What makes you think it is not supported? I guess becaus

Re: [Rd] FYI: daily R source tarballs from ETH: *.xz instead of *.bz2)

2023-09-08 Thread Hervé Pagès
daily/?C=M;O=D > > > Best, > Martin > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com [[alternative HTML version deleted]]

Re: [Rd] codetools wrongly complains about lazy evaluation in S4 methods

2023-06-15 Thread Hervé Pagès
ride anything so should not disrupt anything. H. On 6/15/23 13:51, Hervé Pagès wrote: > > I'd argue that at the root of the problem is that your qr.X() generic > dispatches on all its arguments, including the 'ncol' argument which I > think the dispatch mechanism needs to e

Re: [Rd] codetools wrongly complains about lazy evaluation in S4 methods

2023-06-15 Thread Hervé Pagès
r.X)[["ncol"]] >>>> if (complete) nrow(R) else min(dim(R)) >>>> >>>> where 'R' must be defined in the body of any method that might >>>> evaluate >>>> 'ncol'. >>>> >>> >>> Perhaps I am misunderstanding something, but I think Mikael

[Rd] issue with .local() hack used in S4 methods

2023-05-20 Thread Hervé Pagès
_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: America/Los_Angeles tzcode source: system (glibc) attached base packages: [1] stats graphics  grDevices utils datasets  methods base loaded via a namespace (and not attached): [1] compiler_4.3.0   codetools_0.2-19 -

Re: [Rd] mapply(): Special case of USE.NAMES=TRUE with recent R-devel updates

2021-11-30 Thread Hervé Pagès
an error. The help is not explicit what should happen when the length "of the first ... argument" is zero, but the above behavior effectively does something like: answer <- list() first <- "A" names(answer) <- first[seq_along(answer)] answer named list()

Re: [Rd] How can a package be aware of whether it's on CRAN

2021-11-23 Thread Hervé Pagès
em don't set this env var manually, either. Gabor [...] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com __ R-devel@

Re: [Rd] Spurious warnings in coercion from double/complex/character to raw

2021-09-10 Thread Hervé Pagès
On 10/09/2021 12:53, brodie gaslam wrote: On Friday, September 10, 2021, 03:13:54 PM EDT, Hervé Pagès wrote: Good catch, thanks! Replacing if(ISNAN(vi) || (tmp = (int) vi) < 0 || tmp > 255) { tmp = 0; warn |= WARN_RAW; } pa[i] = (Rbyt

Re: [Rd] Spurious warnings in coercion from double/complex/character to raw

2021-09-10 Thread Hervé Pagès
On 10/09/2021 09:12, Duncan Murdoch wrote: On 10/09/2021 11:29 a.m., Hervé Pagès wrote: Hi, The first warning below is unexpected and confusing:     > as.raw(c(3e9, 5.1))     [1] 00 05     Warning messages:     1: NAs introduced by coercion to integer range     2: out-of-range val

Re: [Rd] Unneeded if statements in RealFromComplex C code

2021-09-10 Thread Hervé Pagès
Thanks Martin! Best, H. On 10/09/2021 02:24, Martin Maechler wrote: Hervé Pagès on Thu, 9 Sep 2021 17:54:06 -0700 writes: > Hi, > I just stumbled across these 2 lines in RealFromComplex (lines 208 & 209 > in src/main/coerce.c): > double

[Rd] Spurious warnings in coercion from double/complex/character to raw

2021-09-10 Thread Hervé Pagès
oblem and its code can be fixed in a similar manner: > as.raw(c("3e9", 5.1)) [1] 00 05 Warning messages: 1: NAs introduced by coercion to integer range 2: out-of-range values treated as 0 in coercion to raw Cheers, H. -- Hervé Pagès Bioconductor Core Team hpage

[Rd] Unneeded if statements in RealFromComplex C code

2021-09-09 Thread Hervé Pagès
able to ignore them). In any case they should probably be removed. Cheers, H. -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] surprised matrix (1:256, 8, 8) doesn't cause error/warning

2021-02-22 Thread Hervé Pagès
__ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Bioconductor Core Team hpages.on.git...@gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-28 Thread Hervé Pagès
Excellent! Thanks Martin. H. On 5/28/20 00:39, Martin Maechler wrote: Martin Maechler on Wed, 27 May 2020 13:35:44 +0200 writes: Hervé Pagès on Tue, 26 May 2020 12:38:13 -0700 writes: >> Hi Martin, On 5/26/20 06:24, Martin Maechler wrote: ... >>>

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-26 Thread Hervé Pagès
> Anyway discussing recycling schemes is interesting but not directly > related with what the OP brought up (behavior of the 'collapse' operation). > Cheers, > H. >> >> ~G -- Hervé Pagès Program in Computational Biology Di

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-24 Thread Hervé Pagès
On 5/24/20 00:26, Gabriel Becker wrote: On Sat, May 23, 2020 at 9:59 PM Hervé Pagès <mailto:hpa...@fredhutch.org>> wrote: On 5/23/20 17:45, Gabriel Becker wrote: > Maybe my intuition is just > different but when I collapse multiple character vectors together,

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-23 Thread Hervé Pagès
On 5/23/20 17:45, Gabriel Becker wrote: Maybe my intuition is just different but when I collapse multiple character vectors together, I expect all the characters from each of those vectors to be in the resulting collapsed one. Yes I'd expect that too. But the **collapse** operation in paste()

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-23 Thread Hervé Pagès
On 5/22/20 18:12, brodie gaslam wrote: FWIW what convinces me is consistency with other aggregating functions applied to zero length inputs: sum(numeric(0)) ## [1] 0 Right. And 1 is the identity element of multiplication: > prod(numeric(0)) [1] 1 And the empty string is the identity elemen

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-22 Thread Hervé Pagès
Software wdunlap tibco.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__tibco.com&d=DwMFaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=Z1o-HO3_OqxOR9LaRguGvnG7X4vF_z1_q13I7zmjcfY&s=7ZT1IjmexPqsDBhrV3NspPTr8M8

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-22 Thread Hervé Pagès
t always had. That's all there is to it. H. On 5/22/20 03:00, Gabriel Becker wrote: Hi Martin et al, On Thu, May 21, 2020 at 9:42 AM Martin Maechler mailto:maech...@stat.math.ethz.ch>> wrote: >>>>> Hervé Pagès >>>>>     on Fri, 15 May 2020 13

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-15 Thread Hervé Pagès
ually be incompatible and paste should throw an error if recycle0 were TRUE and collapse were declared in the same call. I don't think the value of recycle0 should be silently ignored if it is actively specified. ~G On Fri, May 15, 2020 at 11:05 AM Hervé Pagès <mailto:hpa...@fredhutch

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-15 Thread Hervé Pagès
rU9CCUEItSDI96zc0&s=xN84DhkZeoxzn6SG0QTMpOGg2w_ThmjZmZymGUuD0Uw&e= [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&a

Re: [Rd] "cd" floating in the air in the man page for paste/paste0

2020-05-14 Thread Hervé Pagès
Thanks for the fix. H. On 5/12/20 23:29, Tomas Kalibera wrote: Thanks, fixed. Tomas On 5/13/20 5:14 AM, Dirk Eddelbuettel wrote: On 12 May 2020 at 19:59, Hervé Pagès wrote: | While reading about the new 'recycle0' argument of paste/paste0, I | spotted a mysterious "cd"

[Rd] "cd" floating in the air in the man page for paste/paste0

2020-05-12 Thread Hervé Pagès
ot ‘NULL’) should lead to the zero-length ‘character(0)’. cd ^^ This is in R 4.0.0 Patched and R devel. Cheers, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.

Re: [Rd] Rtools and R 4.0.0?

2020-04-28 Thread Hervé Pagès
e.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwIFaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=zMjaTujju0afmK5eIVPZrNajypj8QjuNbSyoAv93ISk&s=vUQZdkVyqq3iT9HukcKqEjg80sI-OZoKuy9DKiufquw&e= -- Hervé Pagès Progr

Re: [Rd] Hard memory limit of 16GB under Windows?

2020-04-07 Thread Hervé Pagès
5dXWo2qb7mQwONaCxYeeWgKwycd3y89JoqY-oY&s=ABvG3sGKR5ln27FVCM8dlmZ82X93ZCTigbMxHeBEb6E&e= [[alternative HTML version deleted]] ______ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mail

Re: [Rd] object.size vs lobstr::obj_size

2020-03-27 Thread Hervé Pagès
On 3/27/20 15:19, Hadley Wickham wrote: On Fri, Mar 27, 2020 at 4:01 PM Hervé Pagès <mailto:hpa...@fredhutch.org>> wrote: On 3/27/20 12:00, Hadley Wickham wrote: > > > On Fri, Mar 27, 2020 at 10:39 AM Hervé Pagès mailto:hpa...@fredhutch.org&g

Re: [Rd] object.size vs lobstr::obj_size

2020-03-27 Thread Hervé Pagès
On 3/27/20 12:00, Hadley Wickham wrote: On Fri, Mar 27, 2020 at 10:39 AM Hervé Pagès <mailto:hpa...@fredhutch.org>> wrote: Hi Tomas, On 3/27/20 07:01, Tomas Kalibera wrote: > they provide an over-approximation They can also provide an "under-approxima

Re: [Rd] object.size vs lobstr::obj_size

2020-03-27 Thread Hervé Pagès
that case: setRefClass("A", fields=c(stuff="ANY")) object.size(new("A", stuff=raw(0))) # 680 bytes object.size(new("A", stuff=runif(1e8))) # 680 bytes Why wouldn't object.size() look at the content of environments? Thanks, H. -- Hervé Pag

Re: [Rd] configure --with-pcre1 fails with latest R 4.0 on Ubuntu 14.04

2020-03-22 Thread Hervé Pagès
Excellent. Thank you! H. On 3/20/20 23:55, Tomas Kalibera wrote: On 3/18/20 6:11 PM, Hervé Pagès wrote: Thanks Tomas. Any chance the old version of the error message could be restored? It would definitely be more helpful than the current one. It's confusing to get an error and be to

Re: [Rd] configure --with-pcre1 fails with latest R 4.0 on Ubuntu 14.04

2020-03-18 Thread Hervé Pagès
17/20 8:18 PM, Hervé Pagès wrote: Using --with-pcre1 to configure the latest R 4.0 (revision 77988) on an Ubuntu 14.04.5 LTS system gives me the following error: ... checking if lzma version >= 5.0.3... yes checking for pcre2-config... no checking for pcre_fullinfo in -lpcre... yes checking pcr

[Rd] configure --with-pcre1 fails with latest R 4.0 on Ubuntu 14.04

2020-03-17 Thread Hervé Pagès
eaders are required, or use --with-pcre1 Maybe the real problem is that the PCRE version on this OS is 8.31? The error message is not particularly helpful. Thanks, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fa

Re: [Rd] rounding change

2020-03-11 Thread Hervé Pagès
_ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ByODf3XxvkT0Ag-YiS72sOZMg3b9vKH-pDRcZARaGWQ&s=z5huvy_ZadTqpmI

Re: [Rd] unlink() on "~" removes the home directory

2020-02-26 Thread Hervé Pagès
m/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=C3VCGF44o7jATPOlC8aZhaT4YGU1JtcOixJKZgu6KyI&s=FeZWU9uN-HwDNkSBOmbYXiGqu8q8-U6DI-ddyUn7HHw&e= -- Hervé Pagès Prog

[Rd] Bug in printing array of type "list"

2018-09-26 Thread Hervé Pagès
<- array(NA, 2:0) typeof(a2) # [1] "logical" a2 # <2 x 1 x 0 array of logical> # [,1] # [1,] # [2,] Thanks, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N,

Re: [Rd] as.vector() broken on a matrix or array of type "list"

2018-09-26 Thread Hervé Pagès
Hi Martin, On 09/26/2018 12:41 AM, Martin Maechler wrote: Hervé Pagès on Tue, 25 Sep 2018 23:27:19 -0700 writes: > Hi, Unlike on an atomic matrix, as.vector() doesn't drop > the "dim" attribute of matrix or array of type "list": m <- ma

[Rd] as.vector() broken on a matrix or array of type "list"

2018-09-25 Thread Hervé Pagès
[,3] # [1,] NULL NULL NULL # [2,] NULL NULL NULL is.vector(as.vector(m)) # [1] FALSE Thanks, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail

Re: [Rd] Bias in R's random integers?

2018-09-20 Thread Hervé Pagès
nC_hDq80BUkAUKNwcowN5W1k&s=WOx4NyeYmWxpDG3tBRQ9-_Y3_7YAlKUKOP6gZLs0BrQ&e= __ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q

Re: [Rd] Argument 'dim' misspelled in error message

2018-09-04 Thread Hervé Pagès
Thanks! On 09/01/2018 05:42 AM, Kurt Hornik wrote: Hervé Pagès writes: Thanks: fixed in the trunk with c75223. Best -k Hi, The following error message misspells the name of the 'dim' argument: array(integer(0), dim=integer(0)) Error in array(integer(0), dim =

[Rd] Argument 'dim' misspelled in error message

2018-08-31 Thread Hervé Pagès
rgs(array) function (data = NA, dim = length(data), dimnames = NULL) NULL Cheers, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fre

Re: [Rd] Where does L come from?

2018-08-25 Thread Hervé Pagès
On 08/25/2018 04:33 PM, Duncan Murdoch wrote: On 25/08/2018 4:49 PM, Hervé Pagès wrote: The choice of the L suffix in R to mean "R integer type", which is mapped to the "int" type at the C level, and NOT to the "long int" type, is really unfortunate as it seems to

Re: [Rd] Where does L come from?

2018-08-25 Thread Hervé Pagès
On 08/25/2018 02:23 PM, Dirk Eddelbuettel wrote: On 25 August 2018 at 13:49, Hervé Pagès wrote: | The choice of the L suffix in R to mean "R integer type", which | is mapped to the "int" type at the C level, and NOT to the "long int" | type, is really unfortunat

Re: [Rd] Where does L come from?

2018-08-25 Thread Hervé Pagès
integers ... (It is all murky because the size is an implementation detail and later "essentially everybody" moved to 32 bit integers and 64 bit longs as the 64 bit architectures became prevalent. Which is why when it matters one should really use more explicit types like int32_t

Re: [Rd] longint

2018-08-16 Thread Hervé Pagès
On 08/16/2018 11:30 AM, Prof Brian Ripley wrote: On 16/08/2018 18:33, Hervé Pagès wrote: ... Only on Intel platforms int is 32 bits. Strictly speaking int is only required to be >= 16 bits. Who knows what the size of an int is on the Sunway TaihuLight for example ;-) R's configur

Re: [Rd] longint

2018-08-16 Thread Hervé Pagès
y supported inside data.table. We use it for 64-bit integers as nanosecond timestamps in our nanotime package (which has some converters). Dirk -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B

Re: [Rd] longint

2018-08-15 Thread Hervé Pagès
R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwIFAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=ERck0y30d00Np6hqTNYfjusx1beZim0OrKe9O

[Rd] MARGIN in base::unique.matrix() and base::unique.array()

2018-07-02 Thread Hervé Pagès
domain), ...) : arguments cannot be recycled to the same length > unique(matrix(1:10, ncol=2), MARGIN=3) Error in unique.matrix(matrix(1:10, ncol = 2), MARGIN = 3) : c("MARGIN = 3 is invalid for dim = 5", "MARGIN = 3 is invalid for dim = 2") Thanks, H. -- Hervé Pa

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
24.2µs (note the units) That's a good one. Need to change this in S4Vectors::default_extractROWS() and other places. Thanks! H. Hadley -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
mean max #> #> 1 arr[i, TRUE, TRUE, TRUE] 41.8ms 43.6ms 46.5ms #> 2 arr[i, , , ] 41.7ms 43.1ms 46.3ms On Fri, Jun 8, 2018 at 12:31 PM, Berry, Charles wrote: On Jun 8, 2018, at 11:52 AM, Hadley Wickham wrote: On Fri, Jun 8, 201

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
y Wickham wrote: On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles wrote: On Jun 8, 2018, at 10:37 AM, Hervé Pagès wrote: Also the TRUEs cause problems if some dimensions are 0: > matrix(raw(0), nrow=5, ncol=0)[1:3 , TRUE] Error in matrix(raw(0), nrow = 5, ncol = 0)[1:3, TRUE] :

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
] 2 3 4 subset_ROW(data.frame(x = 1:10, y = 10:1), 2:4) #> x y #> 2 2 9 #> 3 3 8 #> 4 4 7 HTH, Chuck -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Sea

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
On 06/08/2018 10:32 AM, Hervé Pagès wrote: On 06/08/2018 10:15 AM, Michael Lawrence wrote: There probably should be an abstraction for this. In S4Vectors, we have extractROWS(). FWIW the code in S4Vectors that does what your subset_ROW() does is: https://urldefense.proofpoint.com/v2/url?u

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Hervé Pagès
_stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwICAg&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=MF0DzYDiaYtcFXIyQwpQKs9lVbLNvdBBUubTv7BVAfM&s=HsEbNAT5IElAUS-W2VVSeJs4tfQc77heV7BbQxru518&e= -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hut

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
On 05/16/2018 01:24 PM, Michael Lawrence wrote: On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès 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

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
tor", "factor")) is(data.frame(), "vector") # [1] FALSE is(data.frame(), "factor") # [1] FALSE is(data.frame(), "vector_OR_factor") # [1] TRUE etc... Many people stay away from S4 because of these incomprehensible behaviors. Finally note

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
SE is(x, "vector") # [1] TRUE Couldn't we recognize these problems as real, even if they are by design? Hopefully we can all agree that: - the dispatch mechanism should only dispatch, not alter objects; - is() and selectMethod() should not contradict each other. Thanks, H. Mic

[Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-15 Thread Hervé Pagès
37 11 # [4,]48 12 So, luckily, I have a workaround. But shouldn't the dispatch mechanism stay away from the business of altering objects before passed to it? Thanks, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Ca

Re: [Rd] length of `...`

2018-05-08 Thread Hervé Pagès
Thanks Martin for the clarifications. H. On 05/04/2018 06:02 AM, Martin Maechler wrote: Hervé Pagès on Thu, 3 May 2018 08:55:20 -0700 writes: > Hi, > It would be great if one of the experts could comment on the > difference between Hadley's dotlength and

Re: [Rd] length of `...`

2018-05-03 Thread Hervé Pagès
ing the rest using ..1, but I don't know a way to do this for general n in pre-3.5.0 base R. If you don't mind using a package: # works with R 3.1 and up library(rlang) x <- "global" f <- function(...) { x <- "f" g(...) } g <- function(...) { dots <

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Hervé Pagès
dding an as.list.data.frame method that does strict coercion? 2) The S4 coercion system based on as() does strict coercion by default. H. Michael On Tue, Jan 30, 2018 at 2:41 PM, Hervé Pagès <mailto:hpa...@fredhutch.org>> wrote: Hi Gabe, Interestingly the b

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Hervé Pagès
at par for the course here... did I misunderstand something? ~G On Tue, Jan 30, 2018 at 2:24 PM, Hervé Pagès <mailto:hpa...@fredhutch.org>> wrote: I agree that it makes sense to expect as.list() to perform a "strict coercion" i.e. to return an object of class "li

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Hervé Pagès
On 01/30/2018 02:24 PM, Hervé Pagès wrote: 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.fra

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Hervé Pagès
n for "by" and no mention if it has any superclasses. -- Dario Strbenac University of Sydney Camperdown NSW 2050 Australia __ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A

Re: [Rd] sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31

2018-01-30 Thread Hervé Pagès
fmem( n <- countTRUE(x) ) >> str(n) >> ## num 2.15e+09 >> print(n == .Machine$integer.max + 1) >> ## [1] TRUE >> >> print(p) >> ## Rprofmem memory profiling of: >> ## n <- countTRUE(x) >> #

Re: [Rd] as.character(list(NA))

2018-01-22 Thread Hervé Pagès
(list(NA_character_))) [1] TRUE Does this mean deparse() preserves NA-ness for NA_character_ but not NA_real_? -Original Message----- From: R-devel [mailto:r-devel-boun...@r-project.org <mailto:r-devel-boun...@r-project.org>] On Behalf Of Hervé Pagès Sent: M

Re: [Rd] as.character(list(NA))

2018-01-22 Thread Hervé Pagès
r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=VbamM9XRQOlfBakrmlrmQZ7DLgXZ-hhhFeLD-fKpoCo&s=Luhqwpr2bTltIA9Cy7kA4gwcQh16bla0S6OVe3Z09Xo&e= -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N,

[Rd] Unexpected dimnames attribute returned by cbind/rbind

2017-12-22 Thread Hervé Pagès
> dimnames(m0) [[1]] NULL [[2]] NULL Unexpected dimnames attribute! rbind'ing empty vectors also returns a matrix with unexpected dimnames: > dimnames(rbind(character(0), character(0))) [[1]] NULL [[2]] NULL Cheers, H. -- Hervé Pagès Program in Computational B

[Rd] format() doesn't propagate the dim and dimnames when underlying type of array is "list"

2017-12-14 Thread Hervé Pagès
"AA" Integer,5 # c "AA" Integer,5 NULL # d Integer,5 NULL "AA" format(m2) # [1] "1, 2, 3, 4, 5" "NULL" "AA""1, 2, 3, 4, 5" # [5] "NULL" "AA"

Re: [Rd] binary form of is() contradicts its unary form

2017-11-29 Thread Hervé Pagès
lass` 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

Re: [Rd] binary form of is() contradicts its unary form

2017-11-29 Thread Hervé Pagès
w("B")) # [1] "B" "A" ## Does a B object inherit from A? is(new("B"), "A") # [1] TRUE Cheers, H. Note that object class is always `data.frame` here, check: > class(data.frame()) [1] "data.frame" > is(data.frame(), &q

[Rd] binary form of is() contradicts its unary form

2017-11-29 Thread Hervé Pagès
xtends() agrees: > extends("data.frame", "list") [1] TRUE > extends("data.frame", "oldClass") [1] TRUE > extends("data.frame", "vector") [1] TRUE Who is right? Shouldn't 'is(object, class2)' be equival

Re: [Rd] `[<-.data.frame` sets rownames incorrectly

2017-11-21 Thread Hervé Pagès
On 11/21/2017 06:19 PM, Hervé Pagès wrote: Hi, Here is another problem with data frame subsetting: > df <- data.frame(aa=1:3) > value <- data.frame(aa=11:12, row.names=c("A", "B")) > `[<-`(df, 4:5, , value=value) aa 1 1 2 2 3

[Rd] `[<-.data.frame` sets rownames incorrectly

2017-11-21 Thread Hervé Pagès
e) aa 1 1 2 2 3 3 B 12 A 11 For this last result, the rownames of the 2 last rows should be swapped. H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle,

[Rd] `[[<-.data.frame` leaves holes after existing columns and returns a corrupt data frame

2017-11-21 Thread Hervé Pagès
will be truncated or padded with NAs The latter should probably behave like the former in that case. Maybe by sharing more code with it? Thanks, H. -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M

Re: [Rd] split() - unexpected sorting of results

2017-10-20 Thread Hervé Pagès
XHoc9_le3Z1DrZg0nQqg&e= [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&

Re: [Rd] sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31

2017-06-07 Thread Hervé Pagès
Hi Martin, On 06/07/2017 03:54 AM, Martin Maechler wrote: Martin Maechler on Tue, 6 Jun 2017 09:45:44 +0200 writes: Hervé Pagès on Fri, 2 Jun 2017 04:05:15 -0700 writes: >> Hi, I have a long numeric vector 'xx' and I want to use >> sum()

Re: [Rd] surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)

2017-06-06 Thread Hervé Pagès
Error in dim(a2) <- c(2, 3) : invalid first argument On Mon, Jun 5, 2017 at 6:08 PM, Hervé Pagès mailto:hpa...@fredhutch.org>> wrote: Hi, It's nice to be able to define S4 classes with slots that correspond to standard attributes: setClass(

[Rd] surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)

2017-06-05 Thread Hervé Pagès
# 'dimnames' applied to non-array So it seems that the presence of a "dim" or "dimnames" slot prevents a class from being extended. Is this expected? I couldn't find anything in TFM about this. Sorry if I missed it. Thanks, H. -

[Rd] sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31

2017-06-02 Thread Hervé Pagès
hat length() already does this so that wouldn't create a precedent. Also and FWIW prod() avoids the problem by always returning a double, whatever the type of the input is (except on a complex vector). I can provide a patch if this change sounds reasonable. Cheers, H. -- Hervé Pagès Program in

Re: [Rd] stopifnot() does not stop at first non-TRUE argument

2017-05-16 Thread Hervé Pagès
_listinfo_r-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=mLJLORFCunDiCafHllurGVVVHiMf85ExkM7B5DngfIk&s=helOsmplADBmY6Ct7r30onNuD8a6GKz6yuSgjPxljeU&e= -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred H

Re: [Rd] stopifnot() does not stop at first non-TRUE argument

2017-05-15 Thread Hervé Pagès
ot(2+2==5, print("Hey!!!") == "Hey!!!") Stopifnot(2+2==4, print("Hey!!!") == "Hey!!!") Stopifnot(T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,F,T) On 15 May 2017, at 15:37 , Martin Maechler wrote: I'm still curious about Hervé's idea on using switch() for the i

  1   2   3   4   5   >