Hello everybody ! It is my first post on Rstudio community forum, I am in PhD in France in Plant biology and I am helping somebody who need to handle a lot of data. Well, my problem is : Is it possible to create a vector containing a sequence of number (for example 10 to 420 by 10) 10, 20, 30, 40, etc, to 420 ; and to repeat this sequence in order to follow another vector sequence of character?. Writing this question I am seeing that it is really not clear

So this is my data.frame (an extract only)

elements value conditions *distance*

1 Mg24 4.340197e+00 pl1_CT01 *10*

2 Mg24 5.372596e+00 pl1_CT01 *20*

3 Mg24 9.665040e+00 pl1_CT01 *30*

4 Mg24 8.851774e+00 pl1_CT01 *40*

5 Mg24 1.564440e+01 pl1_CT01 *50*

6 Mg24 1.004873e+01 pl1_CT01 *60*

7 Mg24 1.254677e+01 pl1_CT01 *70*

8 Mg24 8.017576e+00 pl1_CT01 *80*

9 Mg24 5.748200e+00 pl1_CT01 *90*

10 Mg24 1.573673e+00 pl1_CT01 *100*

11 Mg24 3.798806e-01 pl1_CT01 *110*

12 Mg24 1.101723e-01 pl1_CT01 *120*

13 Mg24 4.499268e-02 pl1_CT01 *130*

14 Mg24 2.784069e-02 pl1_CT01 *140*

15 Mg24 2.554249e-02 pl1_CT01 *150*

16 Mg24 3.770222e-02 pl1_CT01 *160*

17 Mg24 3.508327e-02 pl1_CT02 *10*

18 Mg24 4.937052e-01 pl1_CT02 *20*

19 Mg24 1.276152e+00 pl1_CT02 *30*

20 Mg24 1.159849e+00 pl1_CT02 *40*

21 Mg24 2.762671e+00 pl1_CT02 *50*

22 Mg24 3.404331e+00 pl1_CT02 *60*

23 Mg24 3.641507e+00 pl1_CT02 *70*

24 Mg24 5.367379e+00 pl1_CT02 *80*

25 Mg24 5.399442e+00 pl1_CT02 *90*

26 Mg24 3.708117e+00 pl1_CT02 *100*

27 Mg24 2.098231e+00 pl1_CT02 *110*

So I have 3 columns : elements, value, and conditions I would like to add a new column called "distance_in_ยตm" containing the famous sequence of number from 10 to 420. BUT the trick is to count 10 by 10 until it changes of condition. When it changes of condition I would like to count again from 10. I put the ideal column next to the data.frame in italics. The big issue in this new column is that I need to reapeat the sequence but the number of value for each condition is different : I let you appreciate the priblem.

If anybody can save my life He will get my eternal gratitude !

Thank for all of you, best wishes !

Alexis