You could do it in a transform, but there is an efficiency hit:
mapDict = {'Q' : 4,
'R' : 1,
'S' : 2
}
headers = list(value.columnNames)
# dict.get() can return a default value if the key is not found in the dictionary.
data = [[value.getValueAt(row,0), mapDict.get(value.getValueAt(row,1), 0)] for row in xrange(value.rowCount)]
return system.dataset.toDataSet(headers, data)
But, you may want to consider putting the raw data in a custom prop and use @pturmel's Integration Toolkit module to do the transform as an expression. Much more performant.