Huffman codes for R