R-面向对象编程

内容: S3 S4 引用类(Reference class, RC) R6扩展包 借助面向对象的编码风格,并加以合理的抽象,我们可以简单地模仿对象的重要特性,于是,问题

字符串操作

打印 "Hello world!" ># [1] "Hello world!" print("Hello world!") ># [1] "Hello world!" 不带索引 cat("Hello world!") ># Hello world! message("Hello world!") ># Hello world! 连接 paste("Hello", "world!") ># [1] "Hello world!" paste("Hello", "world", sep = "-") ># [1] "Hello-world" paste0("Hello", "World") ># [1] "HelloWorld" paste(c("A", "B"), c(1,2)) ># [1] "A 1" "B 2" paste(c("A", "B"), c(1,2), collapse = ",", sep = "") ># [1] "A1,B2"

元编程

内容: 函数式编程:闭包(closures)与高阶函数(higher-order functions) 基于语言计算以及语言对象 非标准计算(non

R的内部机制

内容: 惰性求值 (Lazy evaluation) 复制-修改机制 (Copy-on-modify mechanism) 词法作用域 (Lexical sc