我已经使用了gsub()命令,但是我缺乏如何使每个字母替换为相反行字母的知识。
plugboard<-matrix(sample(letters), nrow=2)
######
plugboard
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,] "v" "y" "r" "d" "n" "l" "f" "t" "e" "w" "u" "h" "i"
[2,] "p" "o" "j" "k" "b" "x" "q" "s" "a" "z" "c" "g" "m"