r - R向现有的S4对象添加一个新槽
问题描述
我试图遵循这个答案,但迷路了。请问有人可以拼出我的具体输入吗?
我有以下称为“经典”的 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”。有没有办法为这样的现有对象添加一个新插槽?
解决方案
推荐阅读
- android - Jetpack workmanager 不返回成功
- laravel - 调用未定义的方法“连接”
- java - Springboot中的@Value返回null
- typescript - 类型中缺少索引签名
- oracle - 引用 where 子句中选择列的值:Oracle
- elasticsearch - 是否可以使用 ElasticSearch.Net 或 Nest 进行动态响应
- c# - xpath 定位器 c# 正确的查找技术
- javascript - 如何使用正则表达式替换 cshtml 文件中 textareafor() 中的特殊字符?
- rest - 在 REST API 中对具有不同权限的客户端应用程序进行身份验证
- python - Matplotlib 在没有数据的情况下保存绘图首选项