Может быть, вы можете попробовать код ниже, используя split
t1 <- do.call(cbind,
lapply(u <- split(df$A,
factor(df$No,levels = seq(max(df$No)))),
`length<-`,
max(lengths(u))))
> t1
1 2 3 4 5 6
[1,] 0.15 0.52 0.54 NA 0.45 1.53
[2,] 0.58 NA 0.05 NA 0.37 0.29
[3,] 0.42 NA 0.15 NA 0.28 1.18
[4,] 1.63 NA NA NA 1.45 NA
t2 <- do.call(cbind,
lapply(u <- split(df$A,
ceiling(df$No/3)),
`length<-`,
max(lengths(u))))
> t2
1 2
[1,] 0.15 0.45
[2,] 0.58 0.37
[3,] 0.42 0.28
[4,] 1.63 1.45
[5,] 0.52 1.53
[6,] 0.54 0.29
[7,] 0.05 1.18
[8,] 0.15 NA
ДАННЫЕ
df <- structure(list(No = c(1L, 1L, 1L, 1L, 2L, 3L, 3L, 3L, 5L, 5L,
5L, 5L, 6L, 6L, 6L), A = c(0.15, 0.58, 0.42, 1.63, 0.52, 0.54,
0.05, 0.15, 0.45, 0.37, 0.28, 1.45, 1.53, 0.29, 1.18), B = c(0.22,
0.43, 0.37, 0.72, 0.4, 0.42, 0.12, 0.22, 0.38, 0.34, 0.3, 0.68,
0.7, 0.3, 0.61), C = c(1.6099, 3.1626, 2.6003, 6.3488, 3.1054,
3.2435, 0.8858, 2.2195, 3.0482, 2.4957, 2.0814, 5.6248, 6.4968,
2.1051, 5.5439)), class = "data.frame", row.names = c(NA, -15L
))