-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I think this is unwanted behaviour, as discard should only act on the elements of the list?
library(mlr3misc) # 0.19.0
res = list(a = 1, b = "tree")
attr(res, "my_attr") = "some_value"
res # has the attribute
#> $a
#> [1] 1
#>
#> $b
#> [1] "tree"
#>
#> attr(,"my_attr")
#> [1] "some_value"
r = mlr3misc::discard(res, is.numeric)
r # extra attribute is removed!
#> $b
#> [1] "tree"
attributes(r)
#> $names
#> [1] "b"Created on 2025-09-23 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels