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

R序列seq

时间:2016-11-22 02:08:05      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:1.5   4.4   6.4   [1]   参数   1.4   eth   nbsp   tca   

> seq(from=10,to=20,by=3)

[1] 10 13 16 19

> seq(from=10,to=20,length=5)

[1] 10.0 12.5 15.0 17.5 20.0

 

## Default S3 method:

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

    length.out = NULL, along.with = NULL, ...)

 

seq.int(from, to, by, length.out, along.with, ...)

 

seq_along(along.with)  从这个参数的长度取长度

seq_len(length.out)  序列所需长度

 

> data.frame(a=seq_along(mtcars$mpg),b=mtcars$mpg,c=seq(along.with= mtcars$mpg))

a     b      c
1   21.0  1
2   21.0  2
3   22.8  3
4   21.4  4
5   18.7  5
6   18.1  6
7   14.3  7
8   24.4  8
9   22.8  9
10 19.2 10
11 17.8 11
12 16.4 12
13 17.3 13
14 15.2 14
15 10.4 15
16 10.4 16
17 14.7 17
18 32.4 18
19 30.4 19
20 33.9 20
21 21.5 21
22 15.5 22
23 15.2 23
24 13.3 24
25 19.2 25
26 27.3 26
27 26.0 27
28 30.4 28
29 15.8 29
30 19.7 30
31 15.0 31
32 21.4 32

R序列seq

标签:1.5   4.4   6.4   [1]   参数   1.4   eth   nbsp   tca   

原文地址:http://www.cnblogs.com/wwxbi/p/6087350.html

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