首页 > 代码库 > R语言常用基础知识
R语言常用基础知识
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)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。