简体   繁体   English

R中的签名是什么意思?

[英]what does signature in R mean?

HI I was reading this doc and it says嗨,我正在阅读这个文档,它说

rules-class规则类

coerce signature(from = "rules", to = "data.frame");强制签名(from = "rules", to = "data.frame"); represents the set of rules as a data.frame将规则集表示为 data.frame

Does this mean I can write code this?这是否意味着我可以编写代码?

coerce(object_of_rules_class, from = 'rules', to = 'data.frame')

What does signature mean - some simple example please?签名是什么意思 - 请举个简单的例子? Thanks-谢谢-

I believe the best definition is provided in "How S4 Methods Work" by J. Chambers, p.2 : a signature is "a named list of classes, with the names corresponding to the formal arguments of the function".我相信J. Chambers 的“How S4 Methods Work”中提供了最好的定义,第 2 页:签名是“一个命名的类列表,其名称对应于函数的形式参数”。 That is to say, it specifies the classes of the arguments.也就是说,它指定了参数的类。

If I understood it correctly, the code you mentioned means the function will coerce the passed argument (an object of class 'rules') into an object of class 'data.frame' before actually being used by the function.如果我理解正确的话,您提到的代码意味着该函数将在函数实际使用之前将传递的参数(“规则”类的对象)强制转换为“data.frame”类的对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM