Re: [Rd] Apply .Rbuildignore before copying files in R CMD build

2024-08-29 Thread Duncan Murdoch
On 2024-08-29 3:34 p.m., Gábor Csárdi wrote: On Thu, Aug 29, 2024 at 12:12 AM Duncan Murdoch wrote: [...] I think the reason is simplicity. The build process can add, delete or modify files. You wouldn't want that to happen on the original source files, so R copies the files to a temp

Re: [Rd] Apply .Rbuildignore before copying files in R CMD build

2024-08-28 Thread Duncan Murdoch
. Having an R package that needs so much data that you can't fit two copies of it on your disk is a really unusual situation. I think it will have to be up to you to fix it (by increasing your temp space, or decreasing the size of some of those files, or something else).

Re: [Rd] specials and ::

2024-08-27 Thread Duncan Murdoch
) ~ datavector + strata(inst), data=lung) if a user had a vector named datavector. Duncan Murdoch Terry On 8/27/24 03:38, peter dalgaard wrote: In my view, that's just plain wrong, because strata() is not a function but a special operator in a model formula. Wouldn't i

Re: [Rd] specials and ::

2024-08-26 Thread Duncan Murdoch
On 2024-08-26 12:34 p.m., Duncan Murdoch wrote: On 2024-08-26 10:42 a.m., Therneau, Terry M., Ph.D. via R-devel wrote: The survival package makes significant use of the "specials" argument of terms(), before calling model.frame; it is part of nearly every modeling function. The reaso

Re: [Rd] specials and ::

2024-08-26 Thread Duncan Murdoch
less likely to show up in another package, but it's old code. This isn't on CRAN yet, so I'd be interested in hearing about problems with this approach, or better solutions. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] specials and ::

2024-08-26 Thread Duncan Murdoch
rary() or require()") in functions that could trigger the problems. Duncan Murdoch Would there be a tolerably easy way to make the fit fail loudly on `survival::strata(…)` rather than return the wrong result? On Aug 26, 2024, at 7:42 AM, Therneau, Terry M., Ph.D. via R-devel wrot

Re: [Rd] Question about regexp edge case

2024-08-09 Thread Duncan Murdoch
Thanks! I think your suggested additions to the docs are perfect. Duncan Murdoch On 2024-08-09 5:01 a.m., Tomas Kalibera wrote: On 8/1/24 20:55, Duncan Murdoch wrote: Thanks Tomas.  Do note that my original post also mentioned a bug or doc error in the PCRE docs for this regexp:   - perl

Re: [Rd] Question about regexp edge case

2024-08-01 Thread Duncan Murdoch
hould only match the literal string "{,5}"). Duncan On 2024-08-01 6:49 a.m., Tomas Kalibera wrote: On 7/29/24 09:37, Ivan Krylov via R-devel wrote: В Sun, 28 Jul 2024 20:02:21 -0400 Duncan Murdoch пишет: gsub("^([0-9]{,5}).*","\\1","123456789

[Rd] Question about regexp edge case

2024-07-28 Thread Duncan Murdoch
"123456789", because "{,5}" is documented to not be a quantifier, so it should only match the literal string "{,5}"). - Some regexp engines (including Perl and Awk) document that "12345" is correct. Is any of this worth fixing? Duncan Murdoch

Re: [Rd] \>

2024-06-29 Thread Duncan Murdoch
x27;t single step through a pipe (as far as I know), but with that modification, you can see what you've got at any point. Duncan Murdoch On 2024-06-29 6:57 p.m., Spencer Graves wrote: Hi, Duncan: On 6/29/24 17:24, Duncan Murdoch wrote:   Yes. I'm not yet facile with "|

[Rd] \>

2024-06-29 Thread Duncan Murdoch
rds: x |> f(a = 1) |> g(b = 2) is just g(f(x, a = 1), b = 2) This isn't quite true of the magrittr pipe, but it is exactly true of the base pipe. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] rbind() on zero row matrices is inconsistent

2024-06-26 Thread Duncan Murdoch
nd to it, but the 0xn matrix is unchanged for n > 0. Clearly from the help this is intentional, but is it desirable? Wouldn't it make more sense for NULL to be ignored by rbind() and cbind()? Duncan Murdoch __ R-devel@r-project.org mai

Re: [Rd] SET_TYPEOF no longer allowed, how should I call R from within C?

2024-06-25 Thread Duncan Murdoch
better, the one that comes with the development version of R. Duncan Murdoch As a more comprehensive example of constructing an R call in C code and evaluating, consider the following fragment of printAttributes in src/main/print.c. /* Need to construct a call to print(CAR(a

Re: [Rd] Segfault when parsing UTF-8 text with srcrefs

2024-05-28 Thread Duncan Murdoch
0x102d22fa0 run_REngineRmainloop + 260 14 R 0x102d1a64c -[REngine runREPL] + 124 15 R 0x102d0dd90 main + 588 16 dyld 0x188fae0e0 start + 2360 Duncan Murdoch __

Re: [Rd] Keep class attribute when applying c() to hexmodes

2024-05-27 Thread Duncan Murdoch
n you should submit a patch containing it to bugs.r-project.org. Based on c.Date, here's a first attempt: c.hexmode <- function(...) as.hexmode(c(unlist(lapply(list(...), function(e) unclass(as.hexmode(e)) If you want this to be incorporated into R, y

[Rd] config.site settings for M3 Mac typo in manual?

2024-05-20 Thread Duncan Murdoch
I've just upgraded to an M3 Mac laptop, and I'm working through getting the right configure settings to build R. The Installation and Administration manual says to have this in config.site: FFLAGS="-g -O2 -mmacos-version-min=11.0" FCFLAGS="-g -O2 -mmacos-version-min=11.0" but those give an err

Re: [Rd] FR: Customize background colour of row and column headers for the View output

2024-05-15 Thread Duncan Murdoch
A criticism of your suggestion is that it is not backwards compatible. Does that matter? I don't know, but probably not. The X11 version of the viewer does what you suggest. Duncan Murdoch On 2024-05-15 2:20 a.m., Iago Giné Vázquez wrote: About the decisions: Actually, the sam

Re: [Rd] FR: Customize background colour of row and column headers for the View output

2024-05-14 Thread Duncan Murdoch
cess to Windows), but I could help with the design. Duncan Murdoch On 2024-05-14 5:25 a.m., Iago Giné Vázquez wrote: Thanks again Duncan and Ivan, I forward then the email to R-devel. Summarizing, the dataedit options (in RGui preferences or RConsole) to colouring the View output do not hav

Re: [Rd] read.csv

2024-04-16 Thread Duncan Murdoch
put as Jing Hua: Input filename.csv: Gene,SNP,prot,log10p YWHAE,13:62129097_C_T,1433E,7.35 YWHAE,4:72617557_T_TA,1433E,7.73 Output: > read.csv("filename.csv") Gene SNP prot log10p 1 YWHAE 13:62129097_C_T 1433 7.35 2 YWHAE 4:72617557_T_TA 1433 7.73 Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Repeated library() of one package with different include.only= entries

2024-04-11 Thread Duncan Murdoch
onal <- Matrix::isDiagonal instead of messing around with the user's search list, which may have been intentionally set to include only one of those. So I'd suggest changing the docs to say "[library and require] check and update the list of currently attached packages and do not reload a namespace which is already loaded. If a package is already attached, no change will be made." Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Bug in out-of-bounds assignment of list object to expression() vector

2024-04-05 Thread Duncan Murdoch
Yes, definitely looks like a bug. Are you able to submit it to bugs.r-project.org? Duncan Murdoch On 05/04/2024 8:15 a.m., June Choe wrote: There seems to be a bug in out-of-bounds assignment of list objects to an expression() vector. Tested on release and devel. (Many thanks to folks over at

Re: [Rd] RSS Feed of NEWS needs a hand

2024-04-02 Thread Duncan Murdoch
On 02/04/2024 8:50 a.m., Dirk Eddelbuettel wrote: On 2 April 2024 at 07:37, Dirk Eddelbuettel wrote: | | On 2 April 2024 at 08:21, Duncan Murdoch wrote: | | I have just added R-4-4-branch to the feeds. I think I've also fixed | | the \I issue, so today's news includes a long l

Re: [Rd] RSS Feed of NEWS needs a hand

2024-04-02 Thread Duncan Murdoch
I have just added R-4-4-branch to the feeds. I think I've also fixed the \I issue, so today's news includes a long list of old changes. Duncan Murdoch On 16/03/2024 8:47 a.m., Duncan Murdoch wrote: I have now put the files online at https://github.com/dmurdoch/diffnews . It seeme

Re: [Rd] declare and validate options

2024-03-29 Thread Duncan Murdoch
e development of the pipe operator: it was in magrittr (and I think another package, but I forget the name) first, was widely adopted, then a simpler version was brought into base R. Duncan Murdoch Le ven. 29 mars 2024 à 16:25, Duncan Murdoch <mailto:murdoch.dun...@gmail.com>> a écr

Re: [Rd] declare and validate options

2024-03-29 Thread Duncan Murdoch
ithout needing to duplicate the rules. If those functions could be made simple enough and bulletproof and were widely adopted, maybe they'd be copied into one of the base packages, but really the only need for that would be to support validation on setting, rather than validation on

Re: [Rd] RSS Feed of NEWS needs a hand

2024-03-16 Thread Duncan Murdoch
I have now put the files online at https://github.com/dmurdoch/diffnews . It seemed like too much trouble to include the SVN history, so this is just a copy of the current version of the files. Duncan Murdoch On 15/03/2024 12:04 p.m., Lluís Revilla wrote: Hi! Thanks for this service! It is

Re: [Rd] RSS Feed of NEWS needs a hand

2024-03-15 Thread Duncan Murdoch
I wrote it about 16 years ago). Duncan Murdoch On 15/03/2024 12:04 p.m., Lluís Revilla wrote: Hi! Thanks for this service! It is very helpful to know what is being developed. I distribute the content to other venues and I noticed some times that the updates are duplicated. For example, the sentence

Re: [Rd] Vignettes with long compute time

2024-03-11 Thread Duncan Murdoch
, but you could always write the code something like this: if (Sys.getenv("RUN_SLOW_CHUNKS", 0)) { ... the slow code goes here ... } else cat("This chunk takes several hours to compute. If you want to run it, set the environment variable RUN_SLOW_CHUNKS to

Re: [Rd] R6 "classname" and generator name

2024-03-11 Thread Duncan Murdoch
R/RandomSearch.R#L11-L12 I don't have any idea if this is intentional or not. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] [External] Re: capture "->"

2024-03-04 Thread Duncan Murdoch
7 9 SYMBOL TRUE x2 9 1 12 1 13 9 10exprFALSE The expressions produced are the same, but the parse data is different. Duncan Murdoch On 04/03/2024 11:51 a.m., Bill Dunlap wrote: Maybe someone has already suggested this, but if your functions accepted st

Re: [Rd] capture "->"

2024-03-02 Thread Duncan Murdoch
the operands reversed when it sees that token. Duncan Murdoch On 02/03/2024 6:06 a.m., Adrian Dușa wrote: That would have been an elegant solution, but it doesn't seem to work: `->` <- `+` 1 -> 3 # expecting 4 Error in 3 <- 1 : invalid (do_set) left-hand side to assignment I

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
On 01/03/2024 8:51 a.m., Dmitri Popavenko wrote: On Fri, Mar 1, 2024 at 1:00 PM Duncan Murdoch <mailto:murdoch.dun...@gmail.com>> wrote: ... I was thinking more of you doing something like   parse(text = "A -> B", keep.source = TRUE) I forget what t

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
On 01/03/2024 5:25 a.m., Dmitri Popavenko wrote: Dear Duncan, On Fri, Mar 1, 2024 at 11:30 AM Duncan Murdoch <mailto:murdoch.dun...@gmail.com>> wrote: ... If you parse it with srcrefs, you could look at the source.  The parser doesn't record whether it was A

Re: [Rd] capture "->"

2024-03-01 Thread Duncan Murdoch
wonder if there is any possibility whatsoever to signal the use of -> instead of <- If you parse it with srcrefs, you could look at the source. The parser doesn't record whether it was A -> B or B <- A anywhere else. Duncan Murdoch __

Re: [Rd] Bug in comparison of language objects?

2024-02-20 Thread Duncan Murdoch
On 20/02/2024 8:03 a.m., Duncan Murdoch wrote: I noticed the following odd behaviour today: exprs <- expression( mean(a), mean(b), { a }, { b } ) exprs[[1]] == exprs[[2]] #> [1] FALSE exprs[[3]] == exprs[[4]] #> [1] TRUE Does it make sense to anyone that the

[Rd] Bug in comparison of language objects?

2024-02-20 Thread Duncan Murdoch
tained in braces doesn't? Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Suggestion: simplify trace() interface

2024-02-19 Thread Duncan Murdoch
here" to be the *only* way to limit tracing to some copies of the function, and if "where" is omitted, trace() should attempt to modify all copies? Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-09 Thread Duncan Murdoch
On 08/02/2024 7:58 p.m., Jiří Moravec wrote: > This is a workaround, and could be the basis for a round.Date improvement: >   date <- Sys.Date() >   as.Date(round(as.POSIXct(date), "years")) >   as.Date(round(as.POSIXct(Sys.Date() + 180), "years"))

Re: [Rd] round.Date and trunc.Date not working / implemented

2024-02-08 Thread Duncan Murdoch
This is a workaround, and could be the basis for a round.Date improvement: date <- Sys.Date() as.Date(round(as.POSIXct(date), "years")) as.Date(round(as.POSIXct(Sys.Date() + 180), "years")) Duncan Murdoch On 08/02/2024 12:23 p.m., Henrik Bengtsson wrote: Techni

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

2024-02-07 Thread Duncan Murdoch
} And here's what I get when I run it on rgl: dupnames("rgl") name first dup 1 fns knitr.R:12 knitr.R:165 2 fns knitr.R:12 pkgdown.R:14 3 fns knitr.R:12shiny.R:8 Those are okay; the fns object is a temporary that is later removed in each case. Duncan Murd

Re: [Rd] [External] Get list of active calling handlers?

2024-02-07 Thread Duncan Murdoch
On 07/02/2024 8:36 a.m., luke-tier...@uiowa.edu wrote: On Tue, 6 Feb 2024, Duncan Murdoch wrote: The SO post https://stackoverflow.com/q/77943180 tried to call globalCallingHandlers() from a function, and it failed with the error message "should not be called with handlers on the stack

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

2024-02-07 Thread Duncan Murdoch
)) { cat("Duplicated names in ", basename(f), ":\n") cat(paste(allnames[dups], collapse = ", "), "\n") } } It could be made more fancy to report the locations of both the original and the dup if you feel motivated. Duncan Murdoch On 06/02/2024 8:0

[Rd] Get list of active calling handlers?

2024-02-06 Thread Duncan Murdoch
including non-global ones (like the one try() added in the line above)? Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

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

2024-02-06 Thread Duncan Murdoch
the check code isn't smart enough to follow every code path, so it gives the note to warn you that you might have something wrong. You still have the same issue with my workaround, but the check code isn't smart enough to notice that. Duncan Murdoch H. On 2/4/24 09:07, Duncan Mur

Re: [Rd] Advice debugging M1Mac check errors

2024-02-04 Thread Duncan Murdoch
Hi John. I don't think the 80 bit format was part of IEEE 754; I think it was an Intel invention for the 8087 chip (which I believe preceded that standard), and didn't make it into the standard. The standard does talk about 64 bit and 128 bit floating point formats, but not 80 bit

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

2024-02-04 Thread Duncan Murdoch
is 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.

Re: [Rd] [Feature Request] Hide API Key in download.file() / R's libcurl

2024-02-01 Thread Duncan Murdoch
I've just been reading https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication, and it states that putting userid:password in the URL is deprecated, but it does make sense that R should protect users who still use that scheme. Duncan Murdoch On 01/02/2024 11:28 a.m., Xinyi

Re: [Rd] [External] readChar() could read the whole file by default?

2024-01-29 Thread Duncan Murdoch
#x27;t know, but I think usually people would want the behaviour of paste(readLines(f), collapse = "\n"). Duncan Murdoch On Fri, Jan 26, 2024 at 2:05 PM luke-tierney--- via R-devel wrote: On Fri, 26 Jan 2024, Michael Chirico wrote: I am curious why readLines() has a default (n=-1L)

Re: [Rd] eval(parse()) within mutate() returning same value for all rows

2023-12-29 Thread Duncan Murdoch
g the last element." That text has been unchanged in the help page for 13 years. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] zapsmall(x) for scalar x

2023-12-17 Thread Duncan Murdoch
I'm really confused. Steve's example wasn't a scalar x, it was a vector. Your zapsmall() proposal wouldn't zap it to zero, and I don't see why summary() would if it was using your proposal. Duncan Murdoch On 17/12/2023 8:43 a.m., Gregory R. Warnes wrote: Isn’t

Re: [Rd] Request: documenting more specifically language objects in the R Language Definition document

2023-12-13 Thread Duncan Murdoch
l. But that's a big benefit for you if you are really interested in working with this kind of thing. Duncan Murdoch On 13/12/2023 4:19 a.m., Iago Giné Vázquez wrote: Dear all, This is a request to get language objects more documented in the R Language Definition document (CRAN version&l

Re: [Rd] system()/system2() using short paths of commands on Windows?

2023-10-31 Thread Duncan Murdoch
*() functions to use only long names doesn't make sense. On the other hand, not modifying the executable name would make a lot of sense, wouldn't it? I'm pretty sure all supported versions of Windows can handle long filenames. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Wayland Display Support in R Plot

2023-10-29 Thread Duncan Murdoch
o get it to work with the ancient OpenGL 1.2 that rgl uses. I forget whether it was just hard or actually impossible. I am slowly working towards having rgl use newer OpenGL versions, but I don't expect this to be done for quite a while. Duncan Murdoch Cheers, Simon Several Linux d

Re: [Rd] FR: valid_regex() to test string validity as a regular expression

2023-10-09 Thread Duncan Murdoch
currently valid code: grepl(1, "abc123") It's not great style, but shouldn't generate an error. Duncan Murdoch At root, the problem is that R does not expose the regex compilation routines like 'tre_regcomp', so from the R side we have to resort to hacky approaches.

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

2023-10-03 Thread Duncan Murdoch
code that catches the warning, but it will also include the context where it was triggered. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-03 Thread Duncan Murdoch
vice" = 1) } This does the dev.set even if there's only one device so it can return the resulting device number. Duncan Murdoch Trevor On Mon, Oct 2, 2023 at 5:25 PM Duncan Murdoch <mailto:murdoch.dun...@gmail.com>> wrote: Thanks!  However, isn't length(dev.l

Re: [Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Duncan Murdoch
Thanks! However, isn't length(dev.list()) == 0 when there are no devices? That's what I'm seeing on MacOS. Duncan Murdoch On 02/10/2023 4:21 p.m., Trevor Davis wrote: > Use it just like dev.off(), but it *will* restore the previous device. I'm observing that if t

[Rd] Problems caused by dev.off() behaviour

2023-10-02 Thread Duncan Murdoch
like dev.off(), but it *will* restore the previous device. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Tight bounding box around text in graphics?

2023-09-26 Thread Duncan Murdoch
I think this is a `ragg` device bug, so I've posted an issue there: https://github.com/r-lib/ragg/issues/143 . That issue contains slightly more detail than I included in the earlier message here. Duncan Murdoch __ R-devel@r-project.org ma

Re: [Rd] Tight bounding box around text in graphics?

2023-09-26 Thread Duncan Murdoch
st which is likeliest? - I have some misconception about how this is supposed to work - The Kanji font on my system misreports some measurements - The ragg::agg_png() device misreports measurements - Some other bug somewhere. Duncan On 26/09/2023 5:57 a.m., Duncan Murdoch wrote: Thanks

Re: [Rd] Tight bounding box around text in graphics?

2023-09-26 Thread Duncan Murdoch
Thanks! I said "base graphics" in my question, but I really have no objection to using grid graphics, so I'll explore those grid functions. Duncan Murdoch On 25/09/2023 3:53 p.m., Paul Murrell wrote: Hi strheight(), which is based GEStrHeight(), is pretty crude, not only igno

[Rd] Tight bounding box around text in graphics?

2023-09-25 Thread Duncan Murdoch
ight" value that includes lots of space below the character, and a "top_border" value that measures from the top of the textbox to the baseline. So I think `height - top_border` would give me what I'm asking for. But this only works with graph

Re: [Rd] Help requested: writing text to a raster in memory

2023-09-24 Thread Duncan Murdoch
ext() match the values used by your Cairo package, or are equivalent measurements available elsewhere? Duncan Murdoch On 24/09/2023 6:55 p.m., Simon Urbanek wrote: Duncan, drawing text is one of the most complicated things you can do, so it really depends how for you want to go. You can d

Re: [Rd] NROW and NCOL on NULL

2023-09-23 Thread Duncan Murdoch
itive and possibly less error prone. If you don't list any examples of problems, then the only possible conclusion is that there aren't any except obscure ones, so the answer is clearly that it is not worth it to make this change. Duncan Murdoch Regards, Simone On Sat, Sep 23,

[Rd] Help requested: writing text to a raster in memory

2023-09-23 Thread Duncan Murdoch
e.g. if some user interaction requires the axis labels to be recomputed and redrawn. Does anyone with experience doing this kind of thing know of examples I can follow, or have advice on how to proceed? Or want to volunteer to help with this? Duncan Murdoch __

Re: [Rd] NROW and NCOL on NULL

2023-09-23 Thread Duncan Murdoch
It's been documented for a long time that NCOL(NULL) is 1. What particular problems did you have in mind? There might be other ways to guard against them. Duncan Murdoch On 23/09/2023 1:43 p.m., Simone Giannerini wrote: Dear list, I do not know what would be the 'correct'

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

2023-09-22 Thread Duncan Murdoch
. 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: We could also question the value of having an infinite number of NA representations in the complex space. For example all thes

Re: [Rd] Strange behaviour of do.call()

2023-09-19 Thread Duncan Murdoch
Sorry, it's a silly thinko. I misspelled the vline argument. Thanks Ivan for the gentle nudge! Duncan Murdoch On 19/09/2023 10:44 a.m., Duncan Murdoch wrote: The knitr::kable() function does some internal setup, including determining the target format, and then calls an internal fun

[Rd] Strange behaviour of do.call()

2023-09-19 Thread Duncan Murdoch
ot;1", "1", "0", "0", "0", "4", "4", "4", "3", "3", "3", "4", "4", "1", "1", "2", "1"), caption = NULL, escape = TRUE, vlign = &

[Rd] Bug in PCRE interface code

2023-09-04 Thread Duncan Murdoch
<<8) + entry[1] - 1; where entry is declared as a pointer to a char. What this is doing is extracting a 16 bit number from the first two bytes of a character string holding the name of the capture group. Since char is a signed type, the conversion of bytes to integer gets messed up and th

Re: [Rd] Calling a replacement function in a custom environment

2023-08-27 Thread Duncan Murdoch
more problematic because of partial name matching. E.g. suppose b was a list containing functions partial(), partial<-(), and part<-(), and I call b$part(x) <- 1 what would be called? Duncan Murdoch On 27/08/2023 10:59 a.m., Konrad Rudolph wrote: Hello all, I am wondering wheth

Re: [Rd] Concerns with SVD -- and the Matrix Exponential

2023-08-16 Thread Duncan Murdoch
le. It's only natural that there will be some contradictions in the responses from those people. It's up to you to read the responses and find the parts of them that are useful to you. It's rude of you to ask one particular respondent to do that work for you. Duncan Murdoc

Re: [Rd] feature request: optim() iteration of functions that return multiple values

2023-08-04 Thread Duncan Murdoch
;- x[1] x2 <- x[2] ans <- 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 if (extraInfo) { list(ans=ans, extras = ...) else ans } Then after optim() finishes, call fr() again with parameters as returned by optim, and extraInfo = TRUE. Duncan Murdoch O

Re: [Rd] Bug in perl=TRUE regexp matching?

2023-07-24 Thread Duncan Murdoch
On 23/07/2023 9:01 p.m., Brodie Gaslam wrote: On 7/23/23 4:29 PM, Duncan Murdoch wrote: The help page for `?gsub` says (in the context of performance considerations): "... just one UTF-8 string will force all the matching to be done in Unicode" It's been a little while si

[Rd] Bug in perl=TRUE regexp matching?

2023-07-23 Thread Duncan Murdoch
d the website https://regex101.com/r/QDFrOE/1 gives the first answer when the regex option /u ("match with full Unicode) is specified, but the second answer when it is not. Now I'm not at all sure that that website is authoritative, but this looks like a flag may have been missed in the `perl = TRUE` case. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] tools::parseLatex() crashes on "\\verb{}"

2023-07-21 Thread Duncan Murdoch
ng R Extensions, which includes links to even more detail. Duncan Murdoch This seems odd to me. I see that `tools::parse_Rd()` doesn't like `\verb!foo!` so maybe roxygen2 is actually doing the right thing (as opposed to just trying to) ? `parse_Rd() ` is probably what I need indeed, for

Re: [Rd] question about an R idiom: eval()ing a quoted block

2023-07-11 Thread Duncan Murdoch
e very old (the second is at least 20 years old). It may be they were written by someone who was thinking in S rather than in R. As far as I recall (but I might be wrong), S didn't have the same scoping rules for accessing and modifying local variables in a function from a nested fun

Re: [Rd] Strange error in R CMD check --timings

2023-07-02 Thread Duncan Murdoch
On 02/07/2023 2:34 p.m., Sebastian Meyer wrote: Am 02.07.23 um 18:01 schrieb Duncan Murdoch: This SO post: https://stackoverflow.com/q/76583828 describes a strange R CMD check error. Depending on the contents of a comment in one of the examples sections of a help page, an error like this could

[Rd] Strange error in R CMD check --timings

2023-07-02 Thread Duncan Murdoch
.yaml")) If that line is skipped (by conditioning on interactive()), the error goes away. But this might be unrelated, since deleting that comment also makes the error go away. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

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

2023-06-12 Thread Duncan Murdoch
nd it when it needs to. Duncan Murdoch On 12/06/2023 2:03 p.m., Mikael Jagan wrote: Thanks both. Yes, I was aware of globalVariables, etc. I guess I was hoping to be pointed to the right place in the source code, in case the issue could be addressed properly, notably as it seems to have al

Re: [Rd] Rd macros are not expanded inside of \eqn{} or \deqn{}

2023-06-12 Thread Duncan Murdoch
be hard to get right. Duncan Murdoch On 12/06/2023 1:55 p.m., Mikael Jagan wrote: I was a bit surprised to learn that, if one has an Rd file as below: %% zzz.Rd \newcommand{\zzz}{whatever} \name{zzz} \title{zzz} \description{ \zzz{} \eqn{\zzz{}} \deqn{\zzz{}} } the

Re: [Rd] How to locate references to an environment?

2023-05-23 Thread Duncan Murdoch
If so, it's referenced from something outside of O. If not, remove the elements of O one by one, until saving it doesn't save the array. The last thing removed is a culprit. (There may be others...) Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Change DEFAULTDEPARSE to DEFAULTDEPARSE | SHOWATTRIBUTES ?

2023-05-06 Thread Duncan Murdoch
sion directly.) BTW, I just noticed something else in deparse() that's probably a bug. > deparse(expr, control = "exact") [1] "quote(I(0x1.921fb54442d18p+1))" I don't know why "quote" is now showing up; it means that parse(text = deparse(expr,

Re: [Rd] Generalised piping into operators

2023-04-21 Thread Duncan Murdoch
quote("_" + 1) : invalid use of pipe placeholder (:1:0) > quote(`+`(_, 1)) Error in quote("_" + 1) : invalid use of pipe placeholder (:1:0) On the other hand, this works: > quote(x |> `+`(e1 = _, 1)) x + 1 So maybe `+`() is fine after all. Duncan Murdoch

Re: [Rd] Generalised piping into operators

2023-04-21 Thread Duncan Murdoch
On 21/04/2023 11:33 a.m., Michael Milton wrote: Thanks, this makes sense. Is there a similar precedence reasoning behind why operator functions (`+` etc) can't be piped into? Yes: > identical(quote(1 + 1), quote(`+`(1, 1))) [1] TRUE Duncan

Re: [Rd] Generalised piping into operators

2023-04-21 Thread Duncan Murdoch
; as.matrix() |> _) + (1 |> colMeans()) because the |> operator has higher precedence than +. Since parens would be needed somewhere to override this, you may as well type (as.matrix(mtcars) + 1) |> colMeans() which is both shorter and arguably clearer than mtcars |> a

Re: [Rd] Unique ID for conditions to supress/rethrow selected conditions?

2023-04-16 Thread Duncan Murdoch
: propose it as a project to be funded by the R Foundation, or as a shorter project in some other way. There are now quite a number of ways to contribute to R, e.g. see https://github.com/r-devel/rdevguide Duncan Murdoch I have two other ideas: By reading the "R messages&

Re: [Rd] Unique ID for conditions to supress/rethrow selected conditions?

2023-04-16 Thread Duncan Murdoch
ot;). For some conditions, it might be sufficient to generate the condition and then use (part of) the generated message as the identifier. But that's not going to always be possible. Duncan Murdoch On 16/04/2023 6:56 a.m., nos...@altfeld-im.de wrote: I am the author of the *tryCatch

Re: [Rd] Error message for infinite probability parameters in rbinom() and rmultinom()

2023-04-08 Thread Duncan Murdoch
2, Inf, Inf)) can't give a useful answer because we don't know the relative size of the two infinities. I imagine the first NA comes from computing prob/sum(prob), which is c(0, 0, NaN). Duncan Murdoch > and OTOH, an NA in prob may return NA (and signal a warning) > in

Re: [Rd] removeSource() vs. function literals

2023-03-30 Thread Duncan Murdoch
g keep.source = FALSE? Maybe a workable solution is something like parse(deparse(expr, control = "exact"), keep.source = FALSE). Wouldn't work on environments or various exotic types, but would probably warn you if it wasn't working. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] [External] subfolders in the R folder

2023-03-28 Thread Duncan Murdoch
ginal file. Duncan Murdoch Of course, one could write a 'build2' shell script locally that wraps all this internally, so that one can call 'R CMD build2 mypkg', which then creates a flattened copy of the package folder, and runs 'R CMD build' on that. Prototyping that

Re: [Rd] Query: Could documentation include modernized references?

2023-03-26 Thread Duncan Murdoch
ng to have to work out the details of the workflow as you go, and earn R Core's trust by submitting good changes and responding to their requests. And maybe don't do any until you hear from a member of R Core that they're willing to participate in this, because they certai

Re: [Rd] WISH: Optional mechanism preventing var <<- value from assigning non-existing variable

2023-03-19 Thread Duncan Murdoch
<-" was intended. A linter could detect this by seeing both `x <- value1` and `x <<- value2` in the same context. That's legal, but (for me at least) it usually indicates that one of them is a typo. Duncan Murdoch ~G On Sun, Mar 19, 2023, 11:16 AM Bill Dunlap <mailto:w

Re: [Rd] WISH: Optional mechanism preventing var <<- value from assigning non-existing variable

2023-03-19 Thread Duncan Murdoch
lback, but the fallback can't work, because the binding is already there but locked...) Duncan Murdoch -Bill On Sun, Mar 19, 2023 at 10:54 AM Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: I think that should be the default behaviour. It's pretty late to get

Re: [Rd] WISH: Optional mechanism preventing var <<- value from assigning non-existing variable

2023-03-19 Thread Duncan Murdoch
I think that should be the default behaviour. It's pretty late to get that into R 4.3.0, but I think your proposal (with check.superassignment = FALSE being the default) could make it in, and 4.4.0 could change the default to TRUE. Duncan On 19/03/2023 12:08 p.m., Henrik Bengtsson

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-14 Thread Duncan Murdoch
On 13/03/2023 6:01 a.m., Duncan Murdoch wrote: Yes, this is really a problem with the checks, not with the language. A simpler approach than your alternativeAssignment function would be simply to allow globalVariables() to be limited to a single function as the note in its help page says. I

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-13 Thread Duncan Murdoch
be automated using methods like "dotify" in dotty. Duncan Murdoch On 12/03/2023 10:36 p.m., Pavel Krivitsky wrote: Dear All, As a maintainer of large, complex packages, I can think of many places in which deconstructing assignment would simplify the code, as well as facilitate read

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-12 Thread Duncan Murdoch
m the current version of dotty, but if they do, the way to proceed is to fork that project, implement your changes, and offer to contribute them back to the main branch. Duncan Murdoch * Positional assignment e.g. .[nr, nc] <- dim(x), and named assignment e.g. .[new = carb] <- m

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-12 Thread Duncan Murdoch
I really like it! Nicely done. Duncan Murdoch On 11/03/2023 6:00 p.m., Kevin Ushey wrote: FWIW, it's possible to get fairly close to your proposed semantics using the existing metaprogramming facilities in R. I put together a prototype package here to demonstrate: https://githu

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-11 Thread Duncan Murdoch
On 11/03/2023 4:42 p.m., Sebastian Martin Krantz wrote: Thanks Duncan and Ivan for the careful thoughts. I'm not sure I can follow all aspects you raised, but to give my limited take on a few: your proposal violates a very basic property of the language, i.e. that all statement

  1   2   3   4   5   6   7   8   9   10   >