Re: [Rd] transform.data.frame() ignores unnamed arguments when no named argument is provided

2023-03-02 Thread Gabriel Becker
On Thu, Mar 2, 2023 at 2:02 PM Antoine Fabri wrote: > Thanks and good point about unspecified behavior. The way it behaves now > (when it doesn't ignore) is more consistent with data.frame() though so I > prefer that to a "warn and ignore" behaviour: > > data.frame(a = 1, b = 2, 3) > > #> a b X

Re: [Rd] transform.data.frame() ignores unnamed arguments when no named argument is provided

2023-03-02 Thread Antoine Fabri
Thanks and good point about unspecified behavior. The way it behaves now (when it doesn't ignore) is more consistent with data.frame() though so I prefer that to a "warn and ignore" behaviour: data.frame(a = 1, b = 2, 3) #> a b X3 #> 1 1 2 3 data.frame(a = 1, 2, 3) #> a X2 X3 #> 1 1 2

Re: [Rd] transform.data.frame() ignores unnamed arguments when no named argument is provided

2023-03-02 Thread Sebastian Meyer
Note that ?transform.data.frame says arguments need to be named, so you are testing unspecified behaviour. I guess this falls in a similar category as the note If some of the values are not vectors of the appropriate length, you deserve whatever you get! Experiments for a related Pro

Re: [Rd] confusing all.equal output

2023-03-02 Thread peter dalgaard
I believe the wording goes back to Martin Maechler many moons ago (AFAICT towards the end of the last millennium.) We might leave it to him to change it? - Peter D. > On 2 Mar 2023, at 19:30 , avi.e.gr...@gmail.com wrote: > > I think if you step back, you can ask what the purpose of an error m

Re: [Rd] confusing all.equal output

2023-03-02 Thread avi.e.gross
I think if you step back, you can ask what the purpose of an error message is and who designs it. Is the message for the developer or others on their team or something an end-user knowing nothing about R will see. This reminds me a bit of legal mumbo jumbo that turns many reading it off as it kee

[Rd] transform.data.frame() ignores unnamed arguments when no named argument is provided

2023-03-02 Thread Antoine Fabri
Dear r-devel, See below: transform(data.frame(a = 1), 2, 3) #> a #> 1 1 transform(data.frame(a = 1), b=2, 3) #> a b X3 #> 1 1 2 3 We need a small modification to make it work consistently, see below: transform.data.frame <- function (`_data`, ...) { e <- eval(substitute(list(..

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Bill Dunlap
x$`string` is not the same as x$'string'. They may act similarly now, but they do not parse the same. > vapply(as.list(quote(list$`component`)), typeof, "") [1] "symbol" "symbol" "symbol" > vapply(as.list(quote(list$"component")), typeof, "") [1] "symbol""symbol""character" > vapply(as.li

Re: [Rd] confusing all.equal output

2023-03-02 Thread Antoine Fabri
Good points. I don't mind the terminology since target and current are the names of the arguments. As the function is already designed to stop at the first failing check we might not need to enumerate or count the mismatches, instead we could have "`NA` found in `target` but not in `current` at pos

Re: [Rd] `dendrapply` Enhancements

2023-03-02 Thread Lakshman, Aidan H
Thanks for your reply! > To answer your implicit question, VECTOR_ELT() unclasses the nodes > because it doesn't go through the stats:::`[[.dendrogram` method, > instead dereferencing the data pointer directly. That�s roughly what I had suspected�I appreciate the clarification. To your point on

Re: [Rd] `dendrapply` Enhancements

2023-03-02 Thread Ivan Krylov
Dear Aidan Lakshman, To answer your implicit question, VECTOR_ELT() unclasses the nodes because it doesn't go through the stats:::`[[.dendrogram` method, instead dereferencing the data pointer directly. Other *apply functions in base R create a call to the `[[` operator, letting the language disp

Re: [Rd] confusing all.equal output

2023-03-02 Thread peter dalgaard
Yes... Also, of course, the sentence after colon does not the describe the cause of the mismatch, e.g. > all.equal(c(1,NA,NA), c(NA,NA,3)) [1] "'is.NA' value mismatch: 2 in current 2 in target" could be confusing. Perhaps "is.na() mismatch (2 positions)", with the count calculated as sum(is.n

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Michael Chirico via R-devel
I personally wouldn't like using a string, and this comment makes me think it's against the r-core preference as well: https://bugs.r-project.org/show_bug.cgi?id=18429#c1 Thanks both for catching the sloppy mistake in vapply() :) Let's continue discussion on the bug/PR. On Thu, Mar 2, 2023 at 1

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Deepayan Sarkar
On Thu, Mar 2, 2023 at 2:09 PM Ivan Krylov wrote: > > There turn out to be a few more things to fix. > > One problem is easy to solve: vapply() needs a third argument > specifying the type of the return value. (Can we have unit tests for > tab completion?) There are tests in src/library/utils/te

Re: [Rd] tab-complete for non-syntactic names could attempt backtick-wrapping

2023-03-02 Thread Ivan Krylov
There turn out to be a few more things to fix. One problem is easy to solve: vapply() needs a third argument specifying the type of the return value. (Can we have unit tests for tab completion?) The other problem is harder: `comps` defaults to an empty string, and you can't have a symbol consisti