Re: [Rd] Creating a long list triggers billions of messages

2025-01-21 Thread Hugh Parsonage
Apologies all. This must have been fixed in a recent version and the cloud error was a resource limit not associated with the issue. On Tue, 21 Jan 2025 at 23:06, Hugh Parsonage wrote: > > I tried doing this on a cloud instance of R 4.4.2 but the terminal > exited and the cloud e

Re: [Rd] Creating a long list triggers billions of messages

2025-01-21 Thread Hugh Parsonage
N=C time zone: UTC 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.4.2 tools_4.4.2 On Tue, 21 Jan 2025 at 22:56, Ivan Krylov wrote: > > В Tue, 21 Jan 2025

[Rd] Creating a long list triggers billions of messages

2025-01-20 Thread Hugh Parsonage
Reprex (not recommended in an interactive session as it is difficult to kill): x <- vector("list", 2^31) which triggers (presumably) billions of error messages like Error: long vectors are not supported yet ../include/Rinlinedfuns.h I believe the error arises from checking each element of the lis

[Rd] "getOption(max.print) omitted %d entries" may be negative

2021-12-28 Thread Hugh Parsonage
In src/main/printvector.c in the definition of printVector and printNamedVector (and elsewhere): Rprintf(" [ reached getOption(\"max.print\") -- omitted %d entries ]\n", n - n_pr); Though n - n_pr is of type R_xlen_t so may not be representable as int. In practice negative values may be observed

Re: [Rd] na.omit inconsistent with is.na on list

2021-08-13 Thread Hugh Parsonage
The data.frame method deliberately skips non-atomic columns before invoking is.na(x) so I think it is fair to assume this behaviour is intentional and assumed. Not so clear to me that there is a sensible answer for list columns. (List columns seem to collide with the expectation that in each varia

[Rd] nchar(x, type = "bytes") seems slower than it could be

2021-03-29 Thread Hugh Parsonage
While profiling some C code, I rolled my own nchar function which appears to be much faster than base R's (25 times faster for a 10M length vector). Obviously base::nchar provides significantly more features than my barebones function (C snippet below); however, for argument type = "bytes" it seem

[Rd] Does type raw really have no ordering?

2021-02-08 Thread Hugh Parsonage
In the help for Extremes ?min > Note that all versions fail for raw and complex vectors since these have no > ordering. This makes sense for complex vectors, yet `raw` vectors seem to have a natural order. Indeed: which.min(as.raw(c(5L, 2L, 1L, 99L))) works and would identify the minimum. Si

Re: [Rd] New pipe operator

2020-12-05 Thread Hugh Parsonage
I'm surprised by the aversion to mtcars |> nrow over mtcars |> nrow() and I think the decision to disallow the former should be reconsidered. The pipe operator is only going to be used when the rhs is a function, so there is no ambiguity with omitting the parentheses. If it's disallowed, it be

Re: [Rd] [External] exists, get and get0 accept silently inputs of length > 1

2020-11-16 Thread Hugh Parsonage
I noticed the recent commit to R-dev (r79434). Is this wise? I've often used get() in constructions like for (j in ls()) if (is.numeric(x <- get(j))) ... (and often interactively, rather than in a package) Am I to understand that get(j) will now be equivalent to `j` even if j is a string referr

Re: [Rd] How to use `[` without evaluating the arguments.

2020-09-25 Thread Hugh Parsonage
This works as expected: "[.foo" <- function(x, i, j) { sx <- substitute(x) si <- substitute(i) sj <- substitute(j) 100 * length(sx) + 10 * length(si) + length(sj) } x <- 1:10 class(x) <- "foo" x[y == z, a(x)] #> [1] 132 Note in your implementation you ask the function evaluate the expres

Re: [Rd] Including full text of open source licenses in a package

2020-09-12 Thread Hugh Parsonage
Perhaps I have misread that excerpt from WRE, but my read is that package authors should not duplicate GNU COPYING, since it is present in all R distributions already when using GPL-2 and friends. It doesn't apply to packages distributed with other licenses. It should be noted that in GPL FAQ jus

Re: [Rd] [External] Re: Operations with long altrep vectors cause segfaults on Windows

2020-09-09 Thread Hugh Parsonage
gt;> wrote: > >>> On 9/8/20 4:48 PM, Hugh Parsonage wrote: > >>>> Unfortunately I only get > >>>> > >>>> [Thread 21752.0x4aa8 exited with code 3221225477] > >>>> [Thread 21752.0x4514 exited with code 3221225477] > &

Re: [Rd] [External] Re: Operations with long altrep vectors cause segfaults on Windows

2020-09-09 Thread Hugh Parsonage
R Under development (unstable) (2020-09-08 r79165) On Wed, 9 Sep 2020 at 18:00, Tomas Kalibera wrote: > > On 9/9/20 9:30 AM, Hugh Parsonage wrote: > > Thank you! > > > > I get > > > > Starting program: C:\R\R-devel-20200909\bin\x64\Rgui.exe > >

Re: [Rd] [External] Re: Operations with long altrep vectors cause segfaults on Windows

2020-09-09 Thread Hugh Parsonage
. 0x6c72d206 in compact_intseq_Dataptr (x=0x12783350, writeable=) at altclasses.c:169 169 altclasses.c: No such file or directory. On Wed, 9 Sep 2020 at 17:03, Tomas Kalibera wrote: > > On 9/9/20 8:48 AM, Hugh Parsonage wrote: > > I am unable to set break or use gdb with any succes

Re: [Rd] [External] Re: Operations with long altrep vectors cause segfaults on Windows

2020-09-08 Thread Hugh Parsonage
te this list might not be the best place to get a tutorial on using gdb on Windows. On Wed, 9 Sep 2020 at 07:47, Jeroen Ooms wrote: > > On Tue, Sep 8, 2020 at 11:44 PM Jeroen Ooms wrote: > > > > On Tue, Sep 8, 2020 at 5:20 PM Tomas Kalibera > > wrote: &g

Re: [Rd] [External] Re: Operations with long altrep vectors cause segfaults on Windows

2020-09-08 Thread Hugh Parsonage
on of R, or can R be debugged using gdb with an off-the-shelf installation?) On Wed, 9 Sep 2020 at 00:32, wrote: > > On Tue, 8 Sep 2020, Hugh Parsonage wrote: > > > Thanks Martin. On further testing, it seems that the segmentation > > fault can only occur when the amou

Re: [Rd] Operations with long altrep vectors cause segfaults on Windows

2020-09-08 Thread Hugh Parsonage
$ R --vanilla --max-mem-size=29G -e "x <- c(0L, -2e9:2e9)" Error: cannot allocate vector of size 14.9 Gb Execution halted On Tue, 8 Sep 2020 at 18:52, Martin Maechler wrote: > > >>>>> Martin Maechler > >>>>> on Tue, 8 Sep 2020 10:40:24 +0200 w

[Rd] Operations with long altrep vectors cause segfaults on Windows

2020-09-08 Thread Hugh Parsonage
I can only reproduce on Windows, but reliably (both 4.0.0 and 4.0.2): $> R --vanilla x <- c(0L, -2e9:2e9) # > Segmentation fault Tried to reproduce on Linux but the above worked as expected. Not an issue merely with the length of the vector; for example, x <- rep_len(1:10, 1e10) works, though th

Re: [Rd] sum() vs cumsum() implicit type coercion

2020-08-25 Thread Hugh Parsonage
(If I may be so bold, although I think it's unlikely that a majority would be in favour of this change, and I doubt anyone is actually proposing it, I think quite a bit more than "a majority" should be required before a change like this should be allowed. Considering the feature that cumsum coerce

Re: [Rd] Speed-up/Cache loadNamespace()

2020-07-19 Thread Hugh Parsonage
My advice would be to avoid the network in one of the following ways 1. Store installed packages on your local drive 2. Copy the installed packages to a tempdir on your local drive each time the script is executed 3. Keep an R session running in perpetuity and source the scripts within that everla

Re: [Rd] stringsAsFactors

2020-04-13 Thread Hugh Parsonage
Further, in addition to the `val <- FALSE` patch a few hours ago by Martin, the line after should also be changed - if(!is.logical(val) || is.na(val) || length(val) != 1L) + if(!is.logical(val) || length(val) != 1L || is.na(val)) ## Consider Sys.setenv("_R_CHECK_LENGTH_1_LOGIC2_" = "TRUE") option

Re: [Rd] specials issue, a heads up

2020-02-24 Thread Hugh Parsonage
I mean if the person filing the bug regards style as more important than the truth of how R treats formulas then they’re literally talking in another language. I strongly recommend you do nothing or at most make a note in the documentation addressing this. Your time is too valuable. On Tue, 25 Fe

[Rd] Minor typo in recent commit

2020-02-11 Thread Hugh Parsonage
I believe should be February 2020 not 2010 --- a/doc/manual/R-exts.texi +++ b/doc/manual/R-exts.texi @@ -2631,9 +2631,9 @@ not necessarily installed) on all known @R{} platforms. As from @R{} 4.0.0 a C++ compiler will be selected only if it conforms to the 2011 standard (`C++11'). A minor upda

Re: [Rd] Development version of R fails tests and is not installed

2020-02-08 Thread Hugh Parsonage
The only observation I can make is that the change to round() was made in r77727 whereas your R-devel appears to be r77715 (so would not exhibit the fixed behaviour). My guess is that there was a perpetual installation failure after r77715 but that the test folder was still retrieved and used. On

Re: [Rd] Getting error in rbindlist

2019-11-01 Thread Hugh Parsonage
This is (was) a bug in data.table that is similar to one which was putatively closed. Recommend you update to the latest version and if the problem persists reopen the issue here https://github.com/Rdatatable/data.table/issues/3032 This mailing list is for R bugs, which this isn’t. R Core can no m

Re: [Rd] Evaluate part of an expression at C level

2019-09-27 Thread Hugh Parsonage
You may be trying to do something similar to hutilscpp::which_first(x < 5) which does most of its work at the R level. That is notice an expression is of the form lhs operator rhs then evaluate each element of lhs separately On Fri, 27 Sep 2019 at 8:35 pm, Morgan Morgan wrote: > Hi, > > I am

Re: [Rd] R CMD check issue

2019-08-28 Thread Hugh Parsonage
The warning is that the vignette failed to be rebuilt due to an error in its code. The error log was truncated. Of course for practical purposes errors and warnings both constitute check failures On Thu, 29 Aug 2019 at 1:56 am, Therneau, Terry M., Ph.D. via R-devel < r-devel@r-project.org> wrote:

[Rd] Documenting else's greed

2019-08-16 Thread Hugh Parsonage
I was initially pretty shocked by the result in this question: https://stackoverflow.com/questions/57527434/when-do-i-need-parentheses-around-an-if-statement-to-control-the-sequence-of-a-f Briefly, the following returns 0, not 3 as might be expected: if (TRUE) { 0 } else { 2 } + 3 At fir

Re: [Rd] install packages with missing pkg argument

2019-07-29 Thread Hugh Parsonage
Are you running that command in RStudio? And do you get the documented results when you run utils::install.packages() rather than just install.packages() If yes, then the function is likely working as advertised and you've mixed up the R and RStudio versions On 29/07/2019, Ant F wrote: > Dear a

Re: [Rd] [EXTERNAL] Re: survival changes

2019-06-01 Thread Hugh Parsonage
Would this not be the case *for* a new package? FWIW I would much prefer packages maintainers who make significant changes also change the name of the package (e.g. to survival2). That way disturbance is minimized and the package’s developers can add features and refactor their code much faster.

[Rd] Spurious warning from checkReplaceFuns about a non-replacement function

2019-03-09 Thread Hugh Parsonage
If a function contains the pattern `<-` it is (with a few exceptions) deemed to be a replacement function and in particular must have second argument `value` to pass R CMD check. Consider the function %<->% or any other function containing <- within grapes. I claim that such functions should not b

[Rd] Behaviour of exists(x) for length(x) > 1

2018-10-15 Thread Hugh Parsonage
It seems that exists accepts character vectors of lengths other than one, but discards all but the first element without an error or warning. Is this intended? The name "exists" is in the singular, so it's not surprising that it only contemplates the length-one instance but in the absence of an e

Re: [Rd] ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1

2018-09-01 Thread Hugh Parsonage
I would add my support for the change. >From a cursory survey of existing code, I'd say that usage like `class(x) == 'y'` -- rather than inherits(x, 'y') or is.y -- is probably going to be the major source of new warnings. So perhaps in the NEWS item it could be noted as a clue for developers enco

[Rd] premature use of startsWith in r75110

2018-08-13 Thread Hugh Parsonage
In r75110 at line 1846 in src/library/tools/R/check.R the following line was changed - if(length(grep("^Found the defunct/removed function", out8))) + if(any(startsWith(out8, "Found the defunct/removed function"))) However, if `out8` is NULL at this point (which is plausible), the original return

Re: [Rd] Byte-compilation failure on different architectures / low-memory systems

2018-06-04 Thread Hugh Parsonage
I believe a reproducible example is to simply have a very large object defined literally (i.e. through structure() etc) in ./R/ . For example, fBasics has a couple of files test-jbLM.R and test-jbTable.R which are about 500 KB. For a given amount of RAM, I believe any sufficiently large file will a

[Rd] grDevices::grey could provide clearer error message when length(alpha) != length(level)

2018-05-10 Thread Hugh Parsonage
e.g. grDevices::grey(level = 0.1, alpha = c(0, 1)) #> Error in grey(level = 0.1, alpha = c(0, 1)) : #> attempt to set index 1/1 in SET_STRING_ELT Perhaps #> Error in grey(level = 0.1, alpha = c(0, 1)) : #> lengths of 'level' and 'alpha' differ __ R-d

Re: [Rd] Proposed speedup of ifelse

2018-05-07 Thread Hugh Parsonage
t I saw, is to avoid as much &ing and subsetting as we can. > If there are no NAs none of the test&ok or test[ok] operations do anything > because ok has only TRUEs in it. Even when there are, we want to do the & > once and avoid test[ok]. > > There are further savings fo

Re: [Rd] download.file does not process gz files correctly (truncates them?)

2018-05-07 Thread Hugh Parsonage
I'd add my support for mode = "wb" to (eventually) become the default, though I respect Tomas's comments about backwards-compatibility. Instead of making the argument mandatory (which would immediately break scripts -- even ones that won't be helped by changing to mode = 'wb') or otherwise changin

Re: [Rd] Proposed speedup of ifelse

2018-05-03 Thread Hugh Parsonage
Thanks Radford. I concur with all your points. I've attempted to address the issues you raised through the github.io post. The new method appears to be slower for test lengths < 100 and possibly longer lengths (not just < 10). Of course length(test) < 100 is very quick, so I simply added this to t

Re: [Rd] Proposed speedup of ifelse

2018-05-02 Thread Hugh Parsonage
eturn(.ifelse(test, yes, no)) + } +} +if (!is.null(attributes_of_test)) { + attributes(out) <- attributes_of_test +} + +out + } else { +return(.ifelse(test, yes, no)) + } +} + +.ifelse <- function(test, yes, no) { ans <- test ok <- !is.na(test) if

[Rd] Proposed speedup of ifelse

2018-05-02 Thread Hugh Parsonage
to reflect this. I've written up a short note detailing the performance improvements and some unit tests at https://hughparsonage.github.io/content/post/A-new-ifelse.html Best Hugh Parsonage __ R-devel@r-project.org mailing list https://stat.ethz.ch

[Rd] Proposal to reduce check times by skipping GitHub pulls and issues URL checks

2018-03-21 Thread Hugh Parsonage
storical changes. Best, Hugh Parsonage. Grattan Institute __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Unclosed parenthesis in grep.Rd

2018-03-04 Thread Hugh Parsonage
Lines 129-131: \code{grep(value = FALSE)} returns a vector of the indices of the elements of \code{x} that yielded a match (or not, for \code{invert = TRUE}. This will be an integer vector unless the input There should be a closing parenthesis after \code{invert = TRUE} __

Re: [Rd] readLines interaction with gsub different in R-dev

2018-02-17 Thread Hugh Parsonage
s = TRUE) [1] "AUTHOR: AMéLIE" # latin1 encoding A call to `readLines` (possibly `scan()` and `read.table` and friends) is essential. On 18 February 2018 at 02:15, Dirk Eddelbuettel wrote: > > On 17 February 2018 at 21:10, Hugh Parsonage wrote: > | I was told to re-raise thi

[Rd] readLines interaction with gsub different in R-dev

2018-02-17 Thread Hugh Parsonage
o end case > conversion. However, the following code runs differently: tempf <- tempfile() writeLines(enc2utf8("author: Amélie"), con = tempf, useBytes = TRUE) entry <- readLines(tempf, encoding = "UTF-8") gsub("(\\w)", "\\U\\1", entry, perl = TRUE

Re: [Rd] Why R should never move to git

2018-01-24 Thread Hugh Parsonage
I think the problem you're experiencing is not uncommon but has a solution. FWIW, I prefer git, but I think the best version control system for R is whatever R-core prefers. If they were 2% more productive working in an MS Word documents with Track Changes than git, so much worse for git. On 25 J

[Rd] R CMD build errors if files cannot be moved, even if they are in Rbuildignore

2017-09-21 Thread Hugh Parsonage
eously when failing to copy files which will never be built. This may or may not make the unlink(allfiles[exclude], recursive = TRUE, force = TRUE) line redundant; I'm not sure. Hugh Parsonage Grattan Institute. [[alternative HTML vers

[Rd] \U or \L perl regex in gsub removes text outside capturing group in UTF-8 contexts

2017-06-19 Thread Hugh Parsonage
glish_Australia.1252 LC_NUMERIC=C [5] LC_TIME=English_Australia.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.0 Many thanks, Hugh Parsonage Associate, Grattan Institute, Melbourne, AU