In R program how to command for the same character situated at the same place in a different word?