ホールド +- 38 個のリストを持つリストのリストがあります。少数のみを選択する必要があります (残りは NULL などの値を持ちません)。そして、それらのリストの素敵なデータフレームを作りたいです。
私のリストのリスト:
structure(list(NULL, AFT = NULL, `AP-2` = NULL, `AT_hook, ETS` = NULL,
`BASIC, HLH` = NULL, BRIGHT = NULL, BRLZ = NULL, `BRLZ, BZIP_1, BZIP_2` = NULL,
bZIP = NULL, DWA = NULL, E2F_TDP = NULL, ETS = structure(list(
MASHvstRap = 8.34818462488622e-05, MASHvsBEEML = 0.000250015234002341,
tRapvsBEEML = 8.80480124829088e-06, frequency = 10, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), FH = structure(list(
MASHvstRap = 1.72864219357795e-05, MASHvsBEEML = 0.000840376826415137,
tRapvsBEEML = 2.54589884424594e-07, frequency = 10, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), GCM = NULL,
HLH = structure(list(MASHvstRap = 1.22573775496788e-08, MASHvsBEEML = 0.00119919900578073,
tRapvsBEEML = 3.60117573203279e-07, frequency = 13, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), HMG = structure(list(
MASHvstRap = 6.07022175358029e-30, MASHvsBEEML = 0.0994358268075855,
tRapvsBEEML = 5.3728011843321e-09, frequency = 44, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), Homeo = structure(list(
MASHvstRap = 4.33277656523673e-123, MASHvsBEEML = 0.442020719677047,
tRapvsBEEML = 8.44025048683083e-74, frequency = 158,
stringsAsFactors = 0), .Names = c("MASHvstRap", "MASHvsBEEML",
"tRapvsBEEML", "frequency", "stringsAsFactors"), row.names = c(NA,
-1L), class = "data.frame"), `Homeo ` = structure(list(MASHvstRap = 3.36388469632471e-14,
MASHvsBEEML = 0.763756578209722, tRapvsBEEML = 3.75944533892572e-07,
frequency = 19, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), `Homeo, PAX` = NULL,
`Homeo, POU` = structure(list(MASHvstRap = 3.06769943976602e-08,
MASHvsBEEML = 0.423594358667165, tRapvsBEEML = 7.51004008659922e-09,
frequency = 11, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), `HSF_DNA-bind` = NULL,
`HTH APSES-type` = NULL, IRF = structure(list(MASHvstRap = 1.25502843779857e-05,
MASHvsBEEML = 0.00094114146973297, tRapvsBEEML = 1.17030570144044e-06,
frequency = 10, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), MADS = NULL,
Myb = NULL, RFX = NULL, SAND = NULL, SANT = NULL, TBOX = NULL,
TBP = NULL, TEA = NULL, unknown = structure(list(MASHvstRap = 4.82890837154273e-32,
MASHvsBEEML = 0.0736357072352032, tRapvsBEEML = 7.20783906680568e-26,
frequency = 121, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), Zf_C2H2 = NULL,
Zf_GATA = NULL, Zn2Cys6 = structure(list(MASHvstRap = 4.71138538453502e-05,
MASHvsBEEML = 0.000623286035357452, tRapvsBEEML = 3.93333369828925e-07,
frequency = 17, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), ZnF_C2H2 = structure(list(
MASHvstRap = 1.62205005760679e-17, MASHvsBEEML = 1.46483433509648e-08,
tRapvsBEEML = 2.89656372293867e-25, frequency = 54, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), ZnF_C4 = structure(list(
MASHvstRap = 4.93181852868703e-06, MASHvsBEEML = 0.0467257430288347,
tRapvsBEEML = 6.69189512726035e-07, frequency = 10, stringsAsFactors = 0), .Names = c("MASHvstRap",
"MASHvsBEEML", "tRapvsBEEML", "frequency", "stringsAsFactors"
), row.names = c(NA, -1L), class = "data.frame"), ZnF_GATA = NULL), .Names = c("",
"AFT", "AP-2", "AT_hook, ETS", "BASIC, HLH", "BRIGHT", "BRLZ",
"BRLZ, BZIP_1, BZIP_2", "bZIP", "DWA", "E2F_TDP", "ETS", "FH",
"GCM", "HLH", "HMG", "Homeo", "Homeo ", "Homeo, PAX", "Homeo, POU",
"HSF_DNA-bind", "HTH APSES-type", "IRF", "MADS", "Myb", "RFX",
"SAND", "SANT", "TBOX", "TBP", "TEA", "unknown", "Zf_C2H2", "Zf_GATA",
"Zn2Cys6", "ZnF_C2H2", "ZnF_C4", "ZnF_GATA"))
ご覧のとおり、いくつかのリストには値が含まれていないため、削除する必要があります。私が欲しいのは、ファミリ、メソッド、p.value、頻度の 4 つの列を持つデータ フレームです。リスト内では、次のようにファミリごとに提供されます: $Zn2Cys6
MASHvstRap MASHvsBEEML tRapvsBEEML frequency
1 4.711385e-05 0.000623286 3.933334e-07 17
したがって、$zn2Cys6 はファミリ名であり、MASHvstRap の前に追加する必要があります。そのため、リストを非公開にして、次の列名を持つデータ フレームに再編成する必要があります (family,method = 'MASHvstRAp',p.value,frequency.lapply(rbind) を使用しようとしましたが、奇妙な構造が得られます。cbind とas.data.frame も役に立ちませんでした。