Bug 15926 - list2env(list()) fails because names(list()) is NULL. Could it return an empty environment?
Summary: list2env(list()) fails because names(list()) is NULL. Could it return an emp...
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.1.0
Hardware: Other Other
: P5 minor
Assignee: R-core
Depends on:
Reported: 2014-08-08 19:58 UTC by Bill Dunlap
Modified: 2018-04-03 09:11 UTC (History)
2 users (show)

See Also:

patch for doc/NEWS.Rd (462 bytes, patch)
2018-04-01 18:50 UTC, Benjamin Tyner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Dunlap 2014-08-08 19:58:53 UTC
Currently list2env(list()) throws an error, apparently because names(list()) is not a character vector.
   > E0 <- list2env(list())
   Error in list2env(list()) : 
     names(x) must be a character vector of the same length as x
Would it break things if this did the same as a zero-long list with a zero-long character names vector?
   > E1 <- list2env( structure(list(), names=character()) )
   > objects(E1, all=TRUE)
Comment 1 Benjamin Tyner 2018-04-01 01:15:37 UTC
Looks like this is now supported, as of R version 3.1.2, so this can be closed?
Comment 2 Benjamin Tyner 2018-04-01 18:50:38 UTC
Created attachment 2331 [details]
patch for doc/NEWS.Rd
Comment 3 Martin Maechler 2018-04-03 09:11:25 UTC
Thank you, Benjamin!

You are right, and I will update  NEWS.Rd  according to your patch (when I update it anyway).