You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the .named=TRUE argument, the homonym check will fail to catch issues if the same set of arguments are passed as a spliced list that would fail if passed directly, leading to users having to add a secondary check if homonyms are not allowed. This seems to occur when the argument being passed is a variable.
reprex below.
library(rlang)
packageVersion("rlang")
#> [1] '1.1.4'R.version$version.string#> [1] "R version 4.4.1 (2024-06-14 ucrt)"df<-data.frame()
named_list<-list(a=df,b=df)
unnamed_list<- unname(named_list)
basic_list<-list(1,2,3)
identical(
dots_list(!!!named_list),
dots_list(a=df,b=df)
)
#> [1] TRUE
identical(
dots_list(!!!unnamed_list),
dots_list(df,df)
)
#> [1] TRUE
identical(
dots_list(!!!unnamed_list, .named=TRUE),
dots_list(df,df, .named=TRUE)
)
#> [1] FALSE
dots_list(!!!unnamed_list, .named=TRUE, .homonyms="error")
#> $`<df[,0]>`#> data frame with 0 columns and 0 rows#> #> $`<df[,0]>`#> data frame with 0 columns and 0 rows
try(dots_list(df,df, .named=TRUE, .homonyms="error"))
#> Error : Arguments in `...` must have unique names.#> ✖ Multiple arguments named `df` at positions 1 and 2.
dots_list(!!!basic_list, .named=TRUE, .homonyms="error")
#> $`1`#> [1] 1#> #> $`2`#> [1] 2#> #> $`3`#> [1] 3
try(dots_list(1,2,3, .named=TRUE, .homonyms="error"))
#> $`1`#> [1] 1#> #> $`2`#> [1] 2#> #> $`3`#> [1] 3
When using the
.named=TRUE
argument, the homonym check will fail to catch issues if the same set of arguments are passed as a spliced list that would fail if passed directly, leading to users having to add a secondary check if homonyms are not allowed. This seems to occur when the argument being passed is a variable.reprex below.
Created on 2024-08-14 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: