[R] adding sequence for each value in a vector

From: Yves Magliulo <ym_at_climpact.com>
Date: Fri 28 Oct 2005 - 01:04:21 EST


hi,

i have a vector like :

x<-c(1,15,30,45,60,90,115)

i know that step by step i have always more than 10

min(diff(x)) >=11

i want to add for each value a sequence of value:value+9 result should be :

1 2 3 4 5 6 7 8 9 10 15 16 17 18 19 20 21 22 23 24 30 31 (...) 39 45 46 (...) 54 60 61 etc..

how can i do this without a loop (i'm sure there is a "elegant" way like always with R but i can't find it this time!)

best,

yves

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 28 04:35:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:51 EST