'Convert list containing lists of different length to a data frame in R
I have a list, which contains lists of different length. Each of these sub-lists contains a vector of the same length.
My goal is to get a dataframe, where each of these vectors is a row. Every solution I came across was not usable because the sub-lists don't have the same length. One example of my list below
[[1]]
[[1]][[1]]
[1] "CGATCTGCTTCTATT" "1" "GA/TC" "DpnI"
[[1]][[2]]
[1] "CGATCTGCTTCTATT" "1" "/GATC" "DpnII Sau3AI MboI"
[[2]]
[[2]][[1]]
[1] "AGATCTGCTTCTATT" "1" "A/GATCT" "BglII"
[[2]][[2]]
[1] "AGATCTGCTTCTATT" "1" "GA/TC" "DpnI"
[[2]][[3]]
[1] "AGATCTGCTTCTATT" "1" "/GATC" "DpnII Sau3AI MboI"
[[3]]
[[3]][[1]]
[1] "CGATCCGCTTCTATT" "1" "GA/TC" "DpnI"
[[3]][[2]]
[1] "CGATCCGCTTCTATT" "1" "/GATC" "DpnII Sau3AI MboI"
[[4]]
[[4]][[1]]
[1] "AGATCCGCTTCTATT" "1" "GA/TC" "DpnI"
[[4]][[2]]
[1] "AGATCCGCTTCTATT" "1" "/GATC" "DpnII Sau3AI MboI"
[[5]]
[[5]][[1]]
[1] "CGTTCAGCTTCTATT" "1" "AG/CT" "AluI"
[[6]]
[[6]][[1]]
[1] "CGCTCAGCTTCTATT" "1" "AG/CT" "AluI"
Each of these "CGCTCAGCTTCTATT" "1" "AG/CT" "AluI" should be a row in the dataframe
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
