Skip to content
Prev 11120 / 12125 Next

[R-pkg-devel] Changes in function call with respect to the current published version

Of course, it should be
With no default for 'data'.

Georgi Boshnakov

-----Original Message-----
From: R-package-devel <r-package-devel-bounces at r-project.org> On Behalf Of Georgi Boshnakov
Sent: 17 December 2024 22:34
To: Jose Barrera-G?mez <jose.barrera at isglobal.org>; R Package Development <r-package-devel at r-project.org>
Subject: Re: [R-pkg-devel] Changes in function call with respect to the current published version
The NEWS file should state this incompatible change, loudly.

If you don't want to break user code, you could make the new signature of the function something like:

myfun(formula, data = mydata, ..., y, x, z)

Then you could start with 

if(!is.formula(formula)) {
    issue a message that this is old syntax;

    create a formula for the user from the arguments }

You need this check since users often don't name the first argument. The purpose of putting y,x, and z after the ... is so that you will have arguments with these names only if the user explicitly named them so.

In the new documentation function describe only the new usage and state that the old arguments are for back compatibility only and will be removed in version x.y.

Georgi Boshnakov
Message-ID: <LO0P265MB63256095642CDE5EE51BDB7AAE052@LO0P265MB6325.GBRP265.PROD.OUTLOOK.COM>
In-Reply-To: <LO0P265MB6325BDD86795FEF0CB21F635AE042@LO0P265MB6325.GBRP265.PROD.OUTLOOK.COM>