2

Is any similar/analog Oracle TRANSLATE command in R environment? Need to change specific chars to numbers:

ORACLE way: TRANSLATE('XQWERTY','QWXY','1234')
Result: '312ERT4'

What could be similar in R?

Sivabalan
  • 849
  • 1
  • 17
  • 41
  • `chartr('QWXY','1234','XQWERTY')` - thought this had to be a dup, but I can't find a perfect one for the life of me. Maybe - https://stackoverflow.com/a/6954528/496803 or https://stackoverflow.com/questions/13503848/replace-letters-with-ciphertext-ones/13504417 – thelatemail Jun 08 '18 at 05:09

1 Answers1

0

There's a standard function chartr. Notice that the order of arguments is slightly different than in TRANSLATE.

chartr("QWXY", "1234", "XQWERTY")

result: "312ERT4"
diziaq
  • 5,216
  • 12
  • 46
  • 65