title: Encoding in R like Python ("ord" and "chr")
body: <p>I was wondering how to do encoding and decoding in R. In Python, we can use ord('a') and chr(97) to transform a letter to number or transform a number to a letter. Do you know any similar functions in R? Thank you!</p>
  
  <p>For example, in python</p>
  
  <blockquote>
    <p>>>>ord("a")</p>
    
    <p>97</p>
    
    <p>>>>ord("A")</p>
    
    <p>65</p>
    
    <p>>>>chr(97)</p>
    
    <p>'a'</p>
    
    <p>>>>chr(90)</p>
    
    <p>'Z'</p>
  </blockquote>
  
  <p>FYI: 
  ord(c) in Python
      Given a string of length one, return an integer representing the Unicode code point of the character when the argument is a unicode object, or the value of the byte when the argument is an 8-bit string. For example, ord('a') returns the integer 97, ord(u'\u2020') returns 8224. This is the inverse of chr() for 8-bit strings and of unichr() for unicode objects. If a unicode argument is given and Python was built with UCS2 Unicode, then the character’s code point must be in the range [0..65535] inclusive; otherwise the string length is two, and a TypeError will be raised.</p>
  
  <p>chr(i) in Python
      Return a string of one character whose ASCII code is the integer i. For example, chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range. See also unichr().</p>