Displaying 1 result from an estimated 1 matches for "menu_env".
2024 Jan 18
2
Should subsetting named vector return named vector including named unmatched elements?
...;bar"
#
# $spam
# NULL
```
The simple fix `menu[select] |> setNames(select)` solves, but it feels
to me like something that could be a default behaviour.
On slightly unrelated note, when I was asking if there is a better
solution, the `menu[select]` seems to allocate more memory than
`menu_env = list2env(menu); mget(select, envir = menu, ifnotfound =
list(NULL)`. Or the sapply solution. Is this a benchmarking artifact?
https://stackoverflow.com/q/77828678/4868692