R - Generate a sequence of numbers -


i trying create sequences of number of 6 cases, 144 cases intervals.

like 1 example

c(1:6, 144:149, 288:293)  1   2   3   4   5   6 144 145 146 147 148 149 288 289 290 291 292 293 

how generate automatically such sequence

seq  

or function ?

i find sequence function helpful in case. if had data in structure this:

(info <- data.frame(start=c(1, 144, 288), len=c(6, 6, 6))) #   start len # 1     1   6 # 2   144   6 # 3   288   6 

then in 1 line with:

sequence(info$len) + rep(info$start-1, info$len) #  [1]   1   2   3   4   5   6 144 145 146 147 148 149 288 289 290 291 292 293 

note solution works if sequences you're combining different lengths.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -