R-seq()

  1. seq(0, 1, length.out = 11)
> seq(0, 1, length.out = 11)
 [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
  1. seq(stats::rnorm(20)) # effectively ‘along‘
> seq(stats::rnorm(20))
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
  1. seq(1, 9, by = 2) # matches ‘end‘
> seq(1, 9, by = 2)
[1] 1 3 5 7 9
  1. seq(1, 9, by = pi) # stays below ‘end‘
> seq(1, 9, by = pi)
[1] 1.000000 4.141593 7.283185
  1. seq(1, 6, by = 3)
> seq(1, 6, by = 3)
[1] 1 4
  1. seq(1.575, 5.125, by = 0.05)
> seq(1.575, 5.125, by = 0.05)
 [1] 1.575 1.625 1.675 1.725 1.775 1.825 1.875 1.925 1.975 2.025 2.075 2.125 2.175 2.225 2.275 2.325 2.375
[18] 2.425 2.475 2.525 2.575 2.625 2.675 2.725 2.775 2.825 2.875 2.925 2.975 3.025 3.075 3.125 3.175 3.225
[35] 3.275 3.325 3.375 3.425 3.475 3.525 3.575 3.625 3.675 3.725 3.775 3.825 3.875 3.925 3.975 4.025 4.075
[52] 4.125 4.175 4.225 4.275 4.325 4.375 4.425 4.475 4.525 4.575 4.625 4.675 4.725 4.775 4.825 4.875 4.925
[69] 4.975 5.025 5.075 5.125
  1. seq(17) # same as 1:17, or even better seq_len(17)
> seq(17)
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
posted @ 2018-11-30 15:30  枫子_dan  阅读(392)  评论(0编辑  收藏  举报