Recursively send list variables to the global environment
Use a recursive function. Not elegant but it appears to work:
nest <- list(A = list(w = 1:5, x = letters[1:5]),
B = list(y = 6:10, z = LETTERS[1:5]))
test <- function(x) {
if(is.list(x)) {
list2env(x, envir = .GlobalEnv)
lapply(x, test)
}
}
test(nest)
ls()
# [1] "A" "B" "nest" "test" "w" "x" "y" "z"