I have a named list that looks like this:
> head(pathways)
$<NA>
NULL
$`2`
[1] "hsa04610"
$`9`
[1] "hsa00232" "hsa00983" "hsa01100"
$`10`
[1] "hsa00232" "hsa00983" "hsa01100"
$<NA>
NULL
$<NA>
NULL
To describe it more formerly. The name of each list is an id number, and the entries of each element of the character vector that are elements of the list is another id number. I can filter out the $<NA>
entries easily with is.na()
, but then I want to change the rest so it would look like:
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))
Any ideas?