zoukankan      html  css  js  c++  java
  • R中list对象属性以及具有list性质的对象

    R语言list的特点:It has length[[ and [ methods, and is recursive because list can contain other list!上图显示了操作符 [[和[的区别!---[返回结果依旧是一个list但是[[已经不是一个list了

    》》具有list属性的类还有

    1、call类对象:The first element of the call is the function that gets called. It’s usually the name of a function:

    > x <- quote(read.csv("important.csv", row.names = FALSE))
    > class(x)
    [1] "call"
    > lenth(x)

    2、formula 类的对象

    dat=data.frame(x1=rnorm(100,m=50),x2=rnorm(100,m=50),x3=rnorm(100,m=50),x4=rnorm(100,m=50),y=rnorm(100))
    m2=lm(y~log(x1)+x2*x3,data=dat)
    newFmla=formula(m2)
    > class(newFmla)
    [1] "formula"
    > length(newFmla)
    [1] 3
    > newFmla[1]
    `~`()
    > newFmla[2]
    y()
    > newFmla[3]
    (log(x1) + x2 * x3)()
  • 相关阅读:
    搭建wamp环境,数据库基础知识
    练习题:选择器和选择好友
    例子:滑动效果
    TCPDump
    内存
    Cache和Buffer的区别(转载)
    经典问题回忆
    history
    DNS
    bc的用法
  • 原文地址:https://www.cnblogs.com/amazement/p/4892303.html
Copyright © 2011-2022 走看看