Using R I am trying to create a grouping variable (y) so that every 10 rows along the whole, uneven dataset are grouped together based on the same number as showed below:
data.frame(x,y)
x y
1 1 1
2 2 1
3 3 1
4 4 1
5 5 1
6 6 1
7 7 1
8 8 1
9 9 1
10 10 1
11 11 2
12 12 2
13 13 2
14 14 2
15 15 2
16 16 2
17 17 2
18 18 2
19 19 2
20 20 2
21 21 3
22 22 3
23 23 3
24 24 3
25 25 3
26 26 3
27 27 3
28 28 3
29 29 3
30 30 3
31 31 4
32 32 4
33 33 4
I tried with seq() and rep() but no luck so far. Can someone please help? Thanks in advance