在R中的向量中拆分列表

时间:2014-12-18 02:12:19

标签: r

我在R中有很多列表,其结构如下:

>lists <- list(a = letters[1:6], b = letters[7:13], c = letters[14:25])   

>lists
$a
[1] "a" "b" "c" "d" "e" "f"

$b
[1] "g" "h" "i" "j" "k" "l" "m"

$c
[1] "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y"

我想分成n个向量来获取:

>a
[1] "a" "b" "c" "d" "e" "f"
>b
[1] "g" "h" "i" "j" "k" "l" "m"
>c
[1] "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" “y"

THX

1 个答案:

答案 0 :(得分:2)

您可以使用list2env

list2env(lists, envir=.GlobalEnv)