我有一个包含2个元素的列表,每个元素本身就是矩阵,向量或列表的混合列表。
第一级列表(包含2个元素)无关紧要,但下一级包含我希望作为输出数据帧列名的样本名称。行应为22,值为字符向量,如下所示。我只显示了前三列和四行所需的输出。
我怎样才能在R?
中这样做渴望输出:
SD.A5.A0R6.ZZ SD.AX.A2HC.ZZ SD.DI.A2QY.ZZ ....
c(0,0) c(0) c(0,0)
c(0,0) c(0) c(0,0)
c(0,0) c(0) c(0,0)
c(0,"down") c(0) c(0,"down")
... ... ...
INPUT :
list(structure(list(SD.A5.A0R6.ZZ = structure(c("0", "0",
"0", "0", "0", "0", "0", "down", "0", "down", "0", "down", "down",
"0", "0", "0", "down", "0", "0", "down", "0", "down", "0", "0",
"0", "0", "0", "down", "0", "down", "0", "0", "down", "0", "0",
"up", "0", "0", "0", "down", "up", "down", "0", "0"), .Dim = c(2L,
22L)), SD.AX.A2HC.ZZ = c("0", "0", "0", "0", "0", "0", "0",
"up", "0", "0", "0", "0", "0", "0", "0", "0", "0", "up",
"0", "0", "0", "0"), SD.DI.A2QY.ZZ = list(c("0", "0"), c("0",
"0"), c("0", "0"), c("0", "down"), c("0", "down"), c("0", "up"
), c("0", "up"), c("up", "down"), c("0", "down"), c("0",
"0"), c("0", "down"), c("0", "down"), c("up", "down"), c("0",
"up", "up"), c("0", "down"), c("down", "0"), c("down", "up"
), c("0", "up"), c("down", "0"), c("0", "up"), c("0", "down",
"up"), c("0", "down"))), .Names = c("SD.A5.A0R6.ZZ", "SD.AX.A2HC.ZZ",
"SD.DI.A2QY.ZZ")), structure(list(SD.N5.A4RV.ZZ = list(
c("0", "0"), c("0", "down"), c("0", "down"), c("0", "0"),
c("0", "down"), c("0", "up"), c("0", "down"), c("0", "0"
), c("down", "0"), c("0", "down"), c("0", "down"), c("0",
"down"), c("down", "up"), c("0", "down"), c("0", "down",
"up"), c("0", "down", "down"), c("down", "0"), c("0", "0"
), c("0", "0"), c("0", "0"), c("0", "down"), c("0", "0")),
SD.N6.A4VF.ZZ = list("0", "0", "0", "0", "0", "0", "0",
"up", "down", "down", "0", "0", c("down", "up"),
"0", "0", "down", "0", "0", "0", "0", "0", "down"), SD.NA.A4QW.ZZ = list(
c("0", "down", "down", "0"), c("0", "0", "down", "down"
), c("0", "down", "down", "down", "up"), c("0", "down",
"down", "0"), c("down", "0", "up"), c("0", "down",
"down", "0"), c("0", "down", "down"), c("down", "up",
"0"), c("down", "0", "0"), c("0", "down", "down"), c("0",
"0", "down", "down"), c("down", "0", "0"), c("0", "down",
"0"), c("0", "down", "down", "up", "up"), c("0",
"down", "down", "down"), c("0", "down", "down", "0"),
c("0", "down", "down"), c("0", "down", "down", "0"),
c("0", "up", "0"), c("0", "down", "down", "down", "up"
), c("0", "down", "down", "down"), c("0", "down", "down"
))), .Names = c("SD.N5.A4RV.ZZ", "SD.N6.A4VF.ZZ",
"SD.NA.A4QW.ZZ")))