I played with the R function gsub2 R: replace characters with gsub, how to create a function? to create ciphertext:
from<-c('s','l','k','u','m','i','x','j','o','p','n','q','b','v','w','z','f','y','t','g','h','a','e','d','c','r') to<-c('z','e','b','r','a','s','c','d','f','g','h','i','j','k','l','m','n','o','p','q','t','u','v','w','x','y')
For instance:
source text: who 1973
ciphertext: ptv ltn'm 1973
The problem is that gsub2 twice replaces a few letters (o-> f-> n and s-> z-> n), which will ruin my encrypted text and make it almost impossible to decode. Can anyone point out the error I'm making? Thanks!