如何找出 R 中为某个类定义的所有方法?
在 R 中,我想了解我可以使用特定类(特别是 BioConductor 中“biomaRt”包中的“Mart”类)做什么。我想查看为此类定义的所有方法。有办法做到这一点吗?
注意:methods
函数没有执行我想要的操作。该函数列出了定义了特定方法的所有类,而不是为某个类定义的所有方法。
In R, I want to get an idea of what I can do with a particular class (specifically, the "Mart" class from the "biomaRt" package in BioConductor). I would like to see all the methods that are defined for this class. Is there a way to do this?
Note: The methods
function does not do what I want. That function lists all the classes for which a specific method is defined, not all the methods defined for a class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊,但是
methods
确实可以满足您的要求。仔细阅读?methods
,您将看到class=
参数就是您要查找的内容。S4 类类似,但您需要使用
showMethods
代替。Ah, but
methods
does do what you want. Read?methods
carefully and you will see theclass=
argument is what you're looking for.S4 classes are similar, but you need to use
showMethods
instead.如果您的类是 S3 类,那么您可以使用methods 函数,但指定类参数。
如果它是 S4 类,则使用 showMethods。
If your class is an S3 class then you use the methods function, but specify the class argument.
If it is an S4 class then use showMethods.