码迷,mamicode.com
首页 > 其他好文 > 详细

R语言常用基础知识

时间:2014-06-07 21:47:17      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:des   c   style   class   code   a   

seq(from = 1, to = 1, by = ((to - from)/(length.out - 1)),
    length.out = NULL, along.with = NULL, ...)

举例----------Examples----------
seq(0, 1, length.out=11)
seq(stats::rnorm(20)) # 
seq(1, 9, by = 2)     # 
seq(1, 9, by = pi)    # 
seq(1, 6, by = 3)
seq(1.575, 5.125, by=0.05)
seq(17) # same as 1:17, or even better seq_len(17)

 

Loops

The most commonly used loop structures in R are for, while and apply loops. Less common are repeat loops. The break function is used to break out of loops, and next halts the processing of the current iteration and advances the looping index.

for(variable in sequence) {
    statements
}

while(condition) statements
apply(X, MARGIN, FUN, ARGs)
 

R语言常用基础知识,布布扣,bubuko.com

R语言常用基础知识

标签:des   c   style   class   code   a   

原文地址:http://www.cnblogs.com/emanlee/p/3774851.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!