R-什么是slot插槽?
来源:互联网 发布:godaddy域名邮箱设置 编辑:程序博客网 时间:2024/05/17 02:59
Slots are linked to S4 objects. A slot can be seen as a part, element or a "property" of an object. Say you have a car object, then you can have the slots "price", "number of doors", "type of engine", "mileage".
插槽Slots和S4对象类型相关。一个插槽可以被看作是一个部分,元素,或者对象的某个特性。比如你有一个对象是车,那么你就有这些插槽:“价格”,“门的数量”,“发动机类型”,“里程数”。
举例如下:
新建:
setClass("Car",representation=representation( price = "numeric", numberDoors="numeric", typeEngine="character", mileage="numeric"))aCar <- new("Car",price=20000,numberDoors=4,typeEngine="V6",mileage=143)> aCarAn object of class "Car"Slot "price":[1] 20000Slot "numberDoors":[1] 4Slot "typeEngine":[1] "V6"Slot "mileage":[1] 143
Here, price, numberDoors, typeEngine and mileage are slots of the S4 class "Car". This is a trivial example, in reality slots themselves can be again complex objects.访问:
Slots can be accessed in numerous ways :
> aCar@price[1] 20000> slot(aCar,"typeEngine")[1] "V6"
Slots: The data contained in an object from an S4 class is defined by the _slots_ in the class definition. Each slot in an object is a component of the object; like components (that is, elements) of a list, these may be extracted and set, using the function ‘slot()’ or more often the operator ‘"@"’. However, they differ from list components in important ways. First, slots can only be referred to by name, not by position, and there is no partial matching of names as with list elements.
注意:@插槽本身也可以是dataframe,插槽位置用@,之后的dataframe元素用$.比如:par(bg=x@colors$bg.col,col.axis=x@colors$fg.col, xaxs='r',las=2,fg=x@colors$fg.col)
0 0
- R-什么是slot插槽?
- vue slot插槽
- vue 插槽slot
- vue slot插槽的使用
- 什么是DIMM插槽?
- 什么是PCI插槽?
- 什么是FDD插槽
- vue动态组件和slot插槽
- Vue——Slot(插槽)
- vue slot插槽的小技巧
- 插槽(slot)机制之 ------ 一 、max_bits的疑惑
- signal-slot 信号/槽(也译信号/插槽)机制
- QT程序实例----信号与插槽(signal and slot)
- Inventor 2014 API 新功能 (6) 插槽件(slot)草图
- PyQt4一个button对应一个slot(插槽)实例源码讲解
- vue使用插槽分发内容slot的用法
- Slot
- slot
- LINUX根文件系统分析
- 【函数】最大公约数和最小公倍数
- 蓝桥杯——奇怪的比赛
- Filter(一)配置及生命周期
- 多线程 同步代码块
- R-什么是slot插槽?
- win7主机和vm上的ubuntu共享文件夹简单三步搞定
- 锂电池参数含义及简单选择
- UVa:254 Towers of Hanoi
- BLOG
- DEDE内容页图片过大导致布局混乱的解决方法
- IOS学习笔记 运用Quartz 2D框架绘制常见的图形(2)
- C++编程规范之33用小类代替巨类
- win7下 XAMPP环境下 安装Symfony2