-
Notifications
You must be signed in to change notification settings - Fork 420
Description
I'm having trouble extending tidyr::unnest generic in my package dtrackr which records what is happening to data frames as they go through a dplyr style pipeline to create a flowchart.
The problem is that in tidyr::unnest deprecated options are processed before the call is dispatched with UseMethod("unnest", ...).
The deprecated options processing throws an error if certain types of additional ... parameters are provided - this is because on line 113-114 of unnest.R there is the following call:
dots <- enquos(cols, ..., .named = TRUE, .ignore_empty = "all")
data <- dplyr::mutate(data, !!!dots)
This mutate call can fail, for example in my case I want to give the user the option to pass an additional .messages parameter when unnesting a tracked_df dataframe but the call:
dplyr::starwars %>%
unnest(films, .messages=c("A test message","another test message"))
throws an error before S3 dispatch at line 114.
Would it be possible to move the code processing the deprecated options into a utility function and call it from unnest.data.frame and unnest.rowwise_df so that I can intercept the additional parameters before flow passes back to tidyr::unnest.data.frame ?
Either that or allow the check to fail more gracefully if unexpected input is encountered?
Many thanks.