I have a list in R, as in the following example:
> exemplo
$`c("64735", "254528")`
[1] "703322"
$`100288287`
[1] "100426225"
$`391195`
[1] "707174" "706331"
I am trying to convert this list to a dataframe while remaining two columns. I used this function:
> Reduce(rbind, Map(cbind, exemplo, gene = names(exemplo)))
gene
[1,] "703322" "c(\"64735\", \"254528\")"
[2,] "100426225" "100288287"
[3,] "707174" "391195"
[4,] "706331" "391195"
but I still have a problem in the second column. Any idea how to do this.
source
share