[Rd] [External] Feature Request: User Prompt + Message First Execution when "Managing Search Path Conflicts"

iuke-tier@ey m@iii@g oii uiow@@edu iuke-tier@ey m@iii@g oii uiow@@edu
Thu May 21 16:40:26 CEST 2020


I looks like you may have misunderstood my post so just to make sure:
There will be no patch to R to support this.

If this is something you want for yourself, then I have shown you how
you can do it.  You can put the code in a startup file if you like.

If you want your students to have this, then you can prepare a startup
file for them that does this.

Best,

luke

On Thu, 21 May 2020, Juan Telleria Ruiz de Aguirre wrote:

> Thank you Mr. Tierney!
>
> Using globalCallingHandlers() to directly handle
> "packageConflictError" is an excellent idea!
>
> The benefits I see for such an implementation are:
> * The patch would be contained within the Conflict Error Handler,
> which should reduce any side effects with an eventual implementation.
> * And by making its usage optional, by setting for example
> options(conflicts.policy.ask = TRUE), in should neither affect any
> packages nor other base code.
>
> Hope it allows R Users to work in a more agile manner, and guide R
> Students through best practices of variable conflict handling in an
> educative manner.
>
> Thanks,
> Juan
>
>> You can get what you are asking for now in R 4.0.0 with
>> globalCallingHandlers and using the packageConflictError object that
>> is signaled. This should get you started:
>>
>> ```
>> options(conflicts.policy = "strict")
>>
>> packageConflictError
>>
>> handle_conflicts <- function(e) {
>>      cat(conditionMessage(e))
>>      opt <- readline(prompt="1: mask.ok; 2: exclude. Choose: ")
>>      if (opt == "1")
>>          conflictRules(e$package, mask.ok = as.character(unlist(e$conflicts)))
>>      else if (opt == "2")
>>          conflictRules(e$package, exclude = as.character(unlist(e$conflicts)))
>>      stop("unresolved conflicts") ## ideal invode a restart here
>> }
>>
>> globalCallingHandlers(packageConflictError = handle_conflicts)
>>
>> library(dplyr)
>> ```
>>
>> An IDE could provide a more sophisticated interface, like a dialog
>> allowing separate choices for each conflict. But this is best left up
>> to the IDE or the user.
>>
>> The one addition to library that might be worth considering is to
>> provide a restart for the handler to invoke.
>>
>> Best,
>>
>> luke
>>
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney using uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-devel mailing list