使用 r 中的循环函数,如何创建一个函数,使每一行中没有匹配的数字?
g=sample(c(1:28, 112, replace=T))
HW=matrix(g, ncol=4, byrow=T)
HW
[,1] [,2] [,3] [,4]
[1,] 13 8 28 27
[2,] 19 16 8 25
[3,] 24 1 6 12
[4,] 23 15 9 23
[5,] 1 18 10 22
[6,] 14 18 15 12
[7,] 18 7 28 7
[8,] 22 26 10 21
[9,] 2 14 24 6
[10,] 14 4 10 8
[11,] 17 16 17 25
[12,] 21 11 19 2
[13,] 15 6 9 4
[14,] 20 19 7 14
[15,] 9 4 5 1
[16,] 11 27 5 12
[17,] 25 14 25 20
[18,] 15 27 16 26
[19,] 18 22 17 6
[20,] 12 1 20 9
[21,] 5 12 16 3
[22,] 25 12 1 17
[23,] 24 6 13 19
[24,] 16 3 1 18
[25,] 3 11 5 24
[26,] 10 9 11 23
[27,] 24 18 7 1
[28,] 5 20 4 25