Re: [R-pkg-devel] A function in one of my package is now a method in base R

2024-08-03 Thread Georgi Boshnakov
From: R-package-devel on behalf of Duncan Murdoch Sent: Friday, August 2, 2024 7:43:46 pm To: Shu Fai Cheung ; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] A function in one of my package is now a method in base R On 2024-08-02 10:35 a.m., Shu Fai Cheung wrote:

Re: [R-pkg-devel] A function in one of my package is now a method in base R

2024-08-03 Thread Duncan Murdoch
The problem with that is a call like sort_by( object = foo, by = bar ) wouldn't be dispatched to the est_table method when foo is an est_table object, it would give a "argument 'x' is missing" kind of error. It would be fine for sort_by( foo, bar ) but would also mess up on sort_by( f

Re: [R-pkg-devel] A function in one of my package is now a method in base R

2024-08-03 Thread Shu Fai Cheung
Thanks a lot for both suggestions! I haven't thought about these approaches, They may solve my problem without breaking existing code. I may just keep the original arguments for backward compatibility. Coincidentally, "object" and "by" have the same meanings as "x" and "y" in base::sort_by() and so

Re: [R-pkg-devel] A function in one of my package is now a method in base R

2024-08-03 Thread Deepayan Sarkar
I haven't thought about this carefully, but shouldn't this mostly work? sort_by.est_table <- function(x, y = c("op", "lhs", "rhs"), object = x, by = y, op_priority = c("=~", "~", "~~", ":=", "~1", "|", "~*~"), number_rows = TRUE, ...) { } -Deepayan On Sat, 3 Aug 2024 at 00:1

Re: [R-pkg-devel] A function in one of my package is now a method in base R

2024-08-02 Thread Duncan Murdoch
On 2024-08-02 10:35 a.m., Shu Fai Cheung wrote: Hi All, I have a function (not a method), sort_by(), in one of my packages. A new method with the same name was introduced in the recent versions of R (4.4.0 or 4.4.1, I forgot which one), resulting in potential conflict in users' code. Certainly,