我有一个如下所示的命名列表:
> head(pathways)
$<NA>
NULL
$`2`
[1] "hsa04610"
$`9`
[1] "hsa00232" "hsa00983" "hsa01100"
$`10`
[1] "hsa00232" "hsa00983" "hsa01100"
$<NA>
NULL
$<NA>
NULL
更早地描述它。每个列表的名称是一个 id 号,作为列表元素的字符向量的每个元素的条目是另一个 id 号。我可以使用 轻松过滤掉$<NA>
条目is.na()
,但是我想更改其余部分,使其看起来像:
id another_id
2 hsa04610
9 hsa00232
9 hsa00983
9 hsa01100
10 hsa00232
10 hsa00983
10 hsa01100
> dput(test)
structure(list(`NA` = NULL, `2` = "hsa04610", `9` = c("hsa00232",
"hsa00983", "hsa01100"), `10` = c("hsa00232", "hsa00983", "hsa01100"
), `NA` = NULL, `NA` = NULL), .Names = c(NA, "2", "9", "10",
NA, NA))
有任何想法吗?