unlist2
is a replacement for base::unlist that does not mangle the names.
unlist_(x, recursive = TRUE, use.names = TRUE, what.names = "inherited")
x | See |
---|---|
recursive | See |
use.names | See |
what.names |
|
Bioconductor AnnotationDbi::unlist2
Use this function if you don't like the mangled names returned by the standard unlist
function from the base package.
Using unlist
with annotation data is dangerous and it is highly recommended to use unlist_
instead.
Herve Pages
#> A.b A2 A.b B1 B2 B3 B4 B5 a a C1 C2 C3 C4 C.d C.e #> -4 2 7 3 2 1 0 -1 1 -2 2 1 0 -1 55 99unlist_(x)#> b A b B B B B B a a C C C C d e #> -4 2 7 3 2 1 0 -1 1 -2 2 1 0 -1 55 99# annotation maps (as in AnnotationDbi objects egids2pbids <- list('10' = 'a', '100' = c('b', 'c'), '1000' = c('d', 'e')) egids2pbids#> $`10` #> [1] "a" #> #> $`100` #> [1] "b" "c" #> #> $`1000` #> [1] "d" "e" #>#> 10 1001 1002 10001 10002 #> "a" "b" "c" "d" "e"# Entrez ids but are the result of unlist() # mangling the names! unlist_(egids2pbids) # much cleaner! yes the names are not unique#> 10 100 100 1000 1000 #> "a" "b" "c" "d" "e"# but at least they are correct...