R 向现有 S4 对象添加一个新槽

问题描述

我试图跟随 this answer 但迷路了。请问有人能说出我的具体意见吗?

我有以下名为“经典”的 S4 对象:

> str(classic)
Formal class 'topGOresult' [package "topGO"] with 5 slots
  ..@ description: chr "Custom Afol today"
  ..@ score      : Named num [1:7633] 0.5735 0.0883 0.8081 0.8005 0.4941 ...
  .. ..- attr(*,"names")= chr [1:7633] "GO:0000002" "GO:0000003" "GO:0000018" "GO:0000027" ...
  ..@ testName   : chr "fisher"
  ..@ algorithm  : chr "classic"
  .. ..- attr(*,"testClass")= chr "classicCount"
  ..@ geneData   : Named int [1:4] 9171 620 5 5361
  .. ..- attr(*,"names")= chr [1:4] "Annotated" "Significant" "NodeSize" "SigTerms"

我可以编辑现有插槽的内容,例如:

classic@description = "Custom Afol today"

但是,我想添加一个名为“本体”的新插槽,其中字符输入为“BP”。有没有办法向这样的现有对象添加新插槽?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)