【发布时间】:2016-10-12 18:35:30
【问题描述】:
我是 S4 课程的新手,四处寻找解决方案但失败了 :( 我有一个 S4 类列表,不确定它是否是嵌套列表,但我想将其更改为数据框。我的列表看起来像这样命名为 z
head(z)
[[1]]
An object of class "AgNode"
Slot "center":
x: 1515, y: 2258
Slot "name":
[1] "hsa:4052"
Slot "txtLabel":
An object of class "AgTextLabel"
Slot "labelText":
[1] "hsa:4052"
Slot "labelLoc":
x: 0, y: 0
Slot "labelJust":
[1] "n"
Slot "labelWidth":
[1] 50
[[2]]
An object of class "AgNode"
Slot "center":
x: 1443, y: 2567
Slot "name":
[1] "hsa:1311"
Slot "txtLabel":
An object of class "AgTextLabel"
等等,我想从中心槽中提取 X 和 Y 值,从名称槽中提取名称。并将这三个放在一个数据框中。我该怎么做?
see<-do.call(cbind, lapply(z, stack))
我试过了,但它给出了一个错误
Error in as.list.default(x) :
no method for coercing this S4 class to a vector
谁能帮帮我?
【问题讨论】: