Hi,
I have data like below:
structure(list(X1 = c(2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L,
6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L,
4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L,
2L, 3L, 4L, 5L, 6L), X10 = c(20L, 30L, 40L, 50L, 60L, 70L, 80L,
90L, 100L, 110L, 120L, 10L, 20L, 30L, 40L, 50L, 60L, 70L, 80L,
90L, 100L, 110L, 120L, 10L, 20L, 30L, 40L, 50L, 60L, 70L, 80L,
90L, 100L, 110L, 120L, 10L, 20L, 30L, 40L, 50L, 60L, 70L, 80L,
90L, 100L, 110L, 120L)), class = "data.frame", row.names = c(NA,
-47L))
I want them to separate and bring in the next column based on when the pattern is being repeated in the first column, arranged data has to look something like below:
structure(list(X1.10.1.70.1.10.1.70.1.10.1.70 = structure(1:5, .Label = c("2 20 2 80 2 20 2 80 2 20 2 80",
"3 30 3 90 3 30 3 90 3 30 3 90", "4 40 4 100 4 40 4 100 4 40 4 100",
"5 50 5 110 5 50 5 110 5 50 5 110", "6 60 6 120 6 60 6 120 6 60 6 120"
), class = "factor")), class = "data.frame", row.names = c(NA,
-5L))
I have been trying with awk
, but problems keep on recurring. Need help.