将S4对象中的多个槽提取到单个矩阵中

时间:2018-03-14 15:27:26

标签: r s4

我有一个带有多个插槽的S4对象(对象)(Slot1,Slot2,Slot3)。我已经能够使用以下方法将各个插槽写入表:

    tablename <- as.matrix(object@Slot1)
    write.csv(tablename, file = "C:\\Users\\Username\\Desktop")

但是,我想把Slot1和Slot2写成同一个矩阵,但我一直无法弄清楚如何这样做。我试过了

   tablename <- as.matrix(object@Slot1, object@Slot2)

并收到错误

   Warning messages: 1: In if (rownames.force %in% FALSE) NULL else if (rownames.force %in%  : the condition has length > 1 and only the first element will be used
   2: In if (rownames.force %in% TRUE) row.names(x) else if 
   (.row_names_info(x) <=  :
   the condition has length > 1 and only the first element will be used

我不确定如何做到这一点,所以任何帮助都会受到赞赏!

0 个答案:

没有答案