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

Of course, it should be 

> myfun(formula, data, ..., y, x, z)

With no default for 'data'.

Georgi Boshnakov

-----Original Message-----
From: R-package-devel <r-package-devel-boun...@r-project.org> On Behalf Of 
Georgi Boshnakov
Sent: 17 December 2024 22:34
To: Jose Barrera-Gómez <jose.barr...@isglobal.org>; R Package Development 
<r-package-devel@r-project.org>
Subject: Re: [R-pkg-devel] Changes in function call with respect to the current 
published version

> myfun(y = birthweight, x = cotinine, z = age, data = mydata, ...)

> and new usage would be

> myfun(formula = birthweight ~ cotinine + age, data = mydata, ...)

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

________________________________________
From: R-package-devel <r-package-devel-boun...@r-project.org> on behalf of Jose 
Barrera-Gómez <jose.barr...@isglobal.org>
Sent: 17 December 2024 21:00
To: R Package Development
Subject: [R-pkg-devel] Changes in function call with respect to the current 
published version

Dear List,

I have a package that works in the context of regression models. The main 
function has arguments (y, x, z, data, ...), where y is the response variable, 
x is the explanatory variable and z can be other covariates.

Due to some bugs, I am interested in changing the call from (y, x, z, data,
...) to (formula, data, ...).

For instance, current usage is

myfun(y = birthweight, x = cotinine, z = age, data = mydata, ...)

and new usage would be

myfun(formula = birthweight ~ cotinine + age, data = mydata, ...)

This change would have no impact on the usage for the rest of the package.

My concern is that users updating the package won't be able to reproduce old 
analyses. I.e. they would need to update the calls to myfun (but nothing else 
related to the usage of other functions or methods).

I think the new usage would result in some advantages and bugs fixing and only 
the disadvantage I mentioned just above.

I would appreciate advice on:

1) There could be other disadvantages for users of previous versions that I 
don't see?

2) What would be the best location(s) in the documentation to explain in detail 
this change?

Thanks in advance,

Jose Barrera
Statistician, Associate Lecturer

*IS**Global*
Barcelona Institute for Global Health - Campus MAR Barcelona Biomedical 
Research Park (PRBB) (Room Hypatia)

Doctor Aiguader, 88
08003 Barcelona, Spain
Tel. +34 93 2147383
jose.barr...@isglobal.org
<https://urldefense.com/v3/__https://www.linkedin.com/in/josebarrera__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_OqfLjGA$
 [linkedin[.]com]> Personal website: sites.google.com/view/josebarrera 
https://urldefense.com/v3/__http://www.isglobal.org__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_stJfB7A$
 [isglobal[.]org]

This message is intended exclusively for its addressee and may contain 
information that is CONFIDENTIAL and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any 
dissemination, copy or disclosure of this communication is strictly prohibited 
by law. If this message has been received in error, please immediately notify 
us via e-mail and delete it.

DATA PROTECTION. We inform you that your personal data, including your e-mail 
address and data included in your email correspondence, are included in the 
ISGlobal Foundation filing system. Your personal data will be used for the 
purpose of contacting you and sending information on the activities of the 
above foundations. You can exercise your rights to  access to personal data, 
rectification, erasure, restriction of processing, data portability and object 
by contacting the following address: *l...@isglobal.org <l...@isglobal.org>*. 
ISGlobal Privacy Policy at 
*https://urldefense.com/v3/__http://www.isglobal.org__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_stJfB7A$
 [isglobal[.]org] 
<https://urldefense.com/v3/__http://www.isglobal.org/__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK9yVqqbBQ$
 [isglobal[.]org]>*.


-----------------------------------------------------------------------------------------------------------------------------

CONFIDENCIALIDAD. Este mensaje y sus anexos se dirigen exclusivamente a su 
destinatario y puede contener información confidencial, por lo que la 
utilización, divulgación y/o copia sin autorización está prohibida por la 
legislación vigente. Si ha recibido este mensaje por error, le rogamos lo 
comunique inmediatamente por esta misma vía y proceda a su destrucción.

PROTECCIÓN DE DATOS. Sus datos de carácter personal utilizados en este envío, 
incluida su dirección de e-mail, forman parte de ficheros de titularidad de la 
Fundación ISGlobal  para cualquier finalidades de contacto, relación 
institucional y/o envío de información sobre sus actividades. Los datos que 
usted nos pueda facilitar contestando este correo quedarán incorporados en los 
correspondientes ficheros, autorizando el uso de su dirección de e-mail para 
las finalidades citadas. Puede ejercer los derechos de acceso, rectificación, 
supresión, limitación del tratamiento, portabilidad y oposición dirigiéndose a 
*l...@isglobal.org
<l...@isglobal.org>* . Política de privacidad en 
*https://urldefense.com/v3/__http://www.isglobal.org__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_stJfB7A$
 [isglobal[.]org] 
<https://urldefense.com/v3/__http://www.isglobal.org/__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK9yVqqbBQ$
 [isglobal[.]org]>*.

--


This message is intended exclusively for its addressee and may contain 
information that is CONFIDENTIAL and protected by professional privilege.
If
you are not the intended recipient you are hereby notified that any 
dissemination, copy or disclosure of this communication is strictly prohibited 
by law. If this message has been received in error, please immediately notify 
us via e-mail and delete it.



DATA PROTECTION. We
inform you that your personal data, including your e-mail address and data 
included in your email correspondence, are included in the ISGlobal Foundation 
files. Your personal data will be used for the purpose of contacting you and 
sending information on the activities of the above foundations. You can 
exercise your rights of access, rectification, cancellation and opposition by 
contacting the following address:
l...@isglobal.org <mailto:l...@isglobal.org>. ISGlobal Privacy Policy at 
https://urldefense.com/v3/__http://www.isglobal.org__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_stJfB7A$
 [isglobal[.]org] 
<https://urldefense.com/v3/__http://www.isglobal.org/__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK9yVqqbBQ$
 [isglobal[.]org]>.



-----------------------------------------------------------------------------------------------------------------------------

CONFIDENCIALIDAD. Este mensaje y sus anexos se dirigen exclusivamente a su 
destinatario y puede contener información confidencial, por lo que la 
utilización, divulgación y/o copia sin autorización está prohibida por la 
legislación vigente. Si ha recibido este mensaje por error, le rogamos lo 
comunique inmediatamente por esta misma vía y proceda a su destrucción.









PROTECCIÓN DE DATOS. Sus datos de carácter personal utilizados en este envío, 
incluida su dirección de e-mail, forman parte de ficheros de titularidad de la 
Fundación ISGlobal  para cualquier finalidades de contacto, relación 
institucional y/o envío de información sobre sus actividades. Los datos que 
usted nos pueda facilitar contestando este correo quedarán incorporados en los 
correspondientes ficheros, autorizando el uso de su dirección de e-mail para 
las finalidades citadas. Puede ejercer los derechos de acceso, rectificación, 
cancelación y oposición dirigiéndose a l...@isglobal.org 
<mailto:l...@isglobal.org>* *. Política de privacidad en 
https://urldefense.com/v3/__http://www.isglobal.org__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK_stJfB7A$
 [isglobal[.]org] 
<https://urldefense.com/v3/__http://www.isglobal.org/__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK9yVqqbBQ$
 [isglobal[.]org]>.

        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list 
https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-package-devel__;!!PDiH4ENfjr2_Jw!CVwdZfO0yYHtB0njRHzPvjXbopN3C4A8qqHbT3BDuJ6uvC08BIjde5hxt_7oeAmYqPRfG0OXgktleUAakOluLXaeqldRxK978yKiXQ$
 [stat[.]ethz[.]ch]

______________________________________________
R-package-devel@r-project.org mailing list 
https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-package-devel__;!!PDiH4ENfjr2_Jw!Cz9VJVZUkyjko2i02uiPQdKXhUPy1waEc4O2bYKfCUFO1ennqTbRVLVmfmolL0voClCtYT_AsA2K5MJAh_sEmAMbPJA_lQ9Bz06mYIqlZZo_-FON$
 [stat[.]ethz[.]ch]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to