按子列表名称访问列表

时间:2015-10-27 08:03:44

标签: r list

我有一个列表列表(foreach循环的输出),每个列表都有相同的字段。现在我想反转这个列表,避免使用for循环。

MWE:

var thisvid;

function onYouTubePlayerAPIReady() {
    thisvid = new YT.Player($('iframe')[0]);
}

if (!thisvid) onYouTubePlayerAPIReady();

$('button').click(function () {
    thisvid.pauseVideo();
});

我想得到:

out_list <- list(list(a = matrix(1:3), b = 2, c = '3'),
             list(a = matrix(11:13), b= 22, c = '33'))

我已尝试使用new_list$a = list(matrix(1:3), matrix(11:13)) new_list$b = list(2, 22) new_list$c = list('3', '33') ,但它没有产生预期效果。

谢谢!

1 个答案:

答案 0 :(得分:1)

我们将'out_list'展平为'lst',split创建'{1}}'lst',如果需要,将names内的名称更改为NULL。 / p>

list
相关问题