'How to load the content of a named list into global environment?

Suppose I have a named list x:

x <- list(a = 1, b = 2)

How can I load the content of x into the global environment so that I can access a and b from the global environment?:

a
# [1] 1
b
# [2] 2

(why I do this: in reality, the x is derived from a .mat file produced by matlab. It's more like an .Rdata file)



Solution 1:[1]

You could also use attach(x) to make a and b available in the search list.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 C.Lloyd